SharePoint Content By Query Webpart PageQueryString and PageFieldValue

Content Query webpart series:
Part 1: Configuring SharePoint 2010 CQWP
Part 2: CQWP PageQueryString and PageFieldValue
Part 3: CQWP XSL customizations
Part 4 : CQWP QueryOverride
PageQueryString allows to configure the Content Query Webpart dynamically using the query string in the url. Let's configure the CQWP to retrieve different categories of announcements based on the query string value. 
Add a CQWP to the page and configure Query section as follows :
Source: Show items from all sites in this site collection
List Type: Announcements
Content Type:Show items of this content type group : My Content Types

Content Type:
Show items of this content type: Company

In additional filters Select "Announcement Category" filed is equal to [PageQueryString : Category]
Save the webpart. I have placed the CQWP on the homepage of my site "", so if I change the url to "http://intranet/SitePages/Home.aspx?Category=Technology", this is the result I get.

PageFieldValue is used to show the related content. Following examples illustrates it. Go to your list which contains our custom content type "Company Announcements". In the ribbon select List->Customize Form->Modify Form Webparts->Default Display Form 
Add CQWP and configure the webpart to use our custom content type. In Additional filters section select Announcement Category is equal to [PageFieldValue:Announcement Category] and  Title is not equal to [PageFieldValue:Title]

This will ensure that when we click on an item we will also get to see related items based on the Announcement Category of the current item and at the same current item will not be shown in the related announcements section.
In next article we will see how to use custom styles with CQWP.