Add dynamic content to a page
You can create dynamic views of your content by using the Content Query Web Part. You can customize the query that defines what content is displayed, and can customize the view settings that determine how that content is presented on the page.
In this article
What is Content Query?
Content Query is a Web Part that displays a dynamic set of items based on a query that you build by using a Web browser. You use the query to specify which items are displayed, and you can set presentation options to determine how those items are displayed on the finished page.
The items that are displayed by the Content Query Web Part always reflect the most current set of items that are retrieved by the query that the page viewer is authorized to see. The query is run whenever the page that contains the Content Query Web Part is viewed. If new content is added and it meets the query criteria, it is automatically displayed by the Content Query Web Part.
Note: There may be a delay of a few minutes between the time that new content is added and when it is displayed by the Content Query Web Part.
After you add the Content Query Web Part to a page, you edit the Web Part to change which items it displays and how it displays them. To edit a Content Query Web Part, click the Edit button at the top right corner of the Web Part, and then click Modify Shared Web Part. A new tool pane opens and displays the Content Query Web Part settings.
There are five categories of settings:
-
Query Use these settings to build the query. For more information about these settings, see the section Build a query.
-
Presentation Use these settings to customize the presentation of the items that are retrieved by the query. For more information about these settings, see the section Customize the data presentation.
-
Appearance Use these settings to adjust the appearance of the Web Part itself. You can change the title, height, width, and chrome (the design and navigation elements that frame the Web Part) of the Web Part by changing these settings. For more information about these settings, see the article Customize Web Parts.
-
Layout Use these settings to adjust the layout of the Web Part. You can change whether the Web Part is visible, whether it is directional (left-to-right, right-to-left, or neither), which zone the Web Part appears in (top, left column, or right column), and the zone index of the Web Part. For more information about these settings, see the article Customize Web Parts.
-
Advanced Use these settings to adjust a variety of more advanced Web Part options. For more information about these settings, see the article Customize Web Parts.
Build a query
You can specify which content the query retrieves by using the following Query settings.
-
Source This setting determines the scope of your query. This setting is required. There are three options:
-
Show items from all sites in this site collection Select this option to query the entire site collection. This is the default setting.
-
Show items from the following site and all subsites Select this option to limit the query to a particular site in the site collection. You can type the address for the site, but we recommend that you use the Browse button to select a site. When you click Browse, the Select Site Web Part dialog box opens and displays a tree view of the site collection. Click the site that you want to query, and then click OK.
-
Show items from the following list: Select this option to limit the query to a particular list or library in the site collection. You can type the address for the list, but we recommend that you use the Browse button to select a list or library. When you click Browse, the Select List or Library Web Part dialog box opens and displays a tree view of the site collection. If the list or library that you want to query is located within a particular site, click the plus sign (+) next to that site's name. When you see the list or library that you want to query, click it, and then click OK.
-
-
List Type This setting is required. You can choose any type of list that is in your site collection. The default setting is Pages Library. The type of list that you choose determines which of the lists or libraries that are in the scope of the query are processed by the query.
-
Content Type There are two settings for Content Type: Content Type Group and Content Type. These settings are optional. You can use these settings to limit the query to items of particular content types that are defined for your site collection.
-
Audience Targeting This setting is optional. If you select Audience Targeting, the query filters the content that it retrieves to show only content that is targeted to the audience that the page viewer belongs to. Audiences are defined system-wide, and cannot be changed by using the Content Query Web Part. This setting only determines whether the Web Part respects Audience Targeting.
When you select Audience Targeting, a second setting becomes available: Always show items that are not explicitly targeted. When you select this setting, any content that is not explicitly targeted to an audience is retrieved by the query, regardless of who is viewing the page. If you select Audience Targeting but do not select this setting, content that is not explicitly targeted to an audience is not retrieved by the query.
-
Additional Filters This setting is optional. You can use this setting to further limit the content that the query retrieves. Choose a filter field, a comparison operator, and enter your criteria. For example, you can use the filter field Author, the comparison operator Is Equal To, and the criterion Toni Poe, to limit the query's results to items that were authored by Toni Poe.
You can specify up to three filters by using the Additional Filters setting. If you use more than one filter, you must specify how the filters are collectively applied by using the AND and OR options that precede the second and third filter.
Customize the data presentation
You can customize the presentation of the content that the query retrieves by using the following Presentation settings. All of these settings are optional.
-
Grouping and Sorting Use these settings to arrange the items that are retrieved by the query.
-
Group Items By Select a field to use to separate items into groups. For example, if you want to group items based on who authored them, select Author.
When you select a field to group by, you can specify whether the items are arranged in ascending or descending order by using the Show groups in ascending order and Show groups in descending order options.
-
Number of Columns Specify the number of columns that you want to use to arrange the items. Items can be arranged in up to five columns.
-
Sort Items By Select a field to use to sort the items. If you have specified that items are grouped, the items are sorted within those groups.
When you select a field to sort by, you can specify whether the items are arranged in ascending or descending order by using the Show items in ascending order and Show items in descending order options.
-
Limit the number of items to display You can limit the number of items that are displayed by setting this option. If you do not specify a limit, all items that are retrieved by the query are displayed. If there are a large number of items, the page expands to accommodate them.
-
-
Styles Use these settings to apply visual styles to groups and items.
-
Group style Select a style to apply to the group heading. For example, if you group by author, each group of items is headed by the author name, and the author name appears in the style that you specify by using this setting.
-
Item style Select a style to apply to items.
-
-
Feed You can choose to have your Content by Query Web Part serve as an RSS Feed. This gives page viewers the option of subscribing to the query results of the Web Part, so that they receive new items when they appear, without having to revisit the page. Use these settings to specify a title and description for the RSS Feed.
-
Feed title Enter a name that you want to use for the RSS Feed. This name helps subscribers to identify the feed in their RSS reader.
-
Feed description Enter a description that you want to use for the RSS Feed. This description helps subscribers to identify the feed in their RSS reader.
-
No comments:
Post a Comment