Skip to content

Search Web Part Examples

This page shows examples you can enter into the "Query Template" box in order to narrow down what a Search Results Web Part can display.

Note that the {searchTerms} generally start the "Query Template" value, and the other text can be mixed and matched with the examples below to form very specific feeds of content (e.g. Related Pages, only in this Site).

Use this example to show pages that are "Related" to the current page, where a "relation" between pages is defined by the MercuryDepartment Page Property.

{searchTerms} owstaxIdMercuryDepartment:{Page.MercuryDepartment.Label}

User-Targeted Content

Use this example to display pages that are targeted to a user based on their user profile, specifically in this example the user's Department specified in the User Profile.

{searchTerms} owstaxIdMercuryDepartment:{User.Department}

Show only Content in this Site

Use this example to only display content that is published to the current site.

{searchTerms} Path:{Site.URL}

Show only content in a specific site

Use this example to only display content in a given site.

{searchTerms} Path:https://contoso.sharepoint.com/sites/hr

Show content from the entire Hub

Use this example to display content from the whole hub, including all associated sites.

{searchTerms} DepartmentId:{{PageContext.hubSiteId}}