In this article we explain how to create a combined feed of only News and Spotlights using the In Focus web part in Atlas.
Prepare an In Focus web part
- First, edit your page and add an In Focus web part (not a specific one such as Documents, but just “In Focus Results (Atlas)”):
- Now edit the web part. Go to the second page of the configuration panel. At the top, clear the Query template box and then paste the code from one of the options below to achieve one of the following outcomes:
Choose the behaviour you want for your query
Option 1: Return both News and Spotlights that match the user’s Preferences (taking into account Spotlight expiry dates):
{searchTerms} ((ContentTypeId:"0x01007D1929FB46214793A0E132E43910AC8202*" AND CPShowOWSBOOL:"1" AND (RefinableDate10<=Today AND RefinableDate11>=Today)) OR ContentTypeId:"0x0101009D1CB255DA76424F860D91F20E6C411800B0B68ED72B2A674E9DF67E796D9320D301*") AND (CPOverrideUserPrefOWSBOOL:1 OR ({|CPLocationGeographyTaxId:{User.CPGeography}}) OR ({|CPDepartmentsTaxId:{User.CPDepartment}})) AND (-ParentLink:/SitePages/Templates)
Option 2: Return both News and Spotlights but ignoring user Preferences (taking into account Spotlight expiry dates):
{searchTerms} ((ContentTypeId:"0x01007D1929FB46214793A0E132E43910AC8202*" AND CPShowOWSBOOL:"1" AND (RefinableDate10<=Today AND RefinableDate11>=Today)) OR ContentTypeId:"0x0101009D1CB255DA76424F860D91F20E6C411800B0B68ED72B2A674E9DF67E796D9320D301*") AND (-ParentLink:/SitePages/Templates)
Please bear in mind when testing option 1 that if the current user doesn’t set any preferences then no items can be returned in the component. And of course the preferences chosen need to match tags on content so you’ll need to ensure there are some News and Spotlights using the same tag.
Test your query
Having chosen one of the above options and pasted the code into the Query template box, test that your web part returns the results you expect. You may want to go to the third page of the configuration panel and set the layout to “Tiles” because this includes a result count which can be very useful for testing, but this is not required.
Once you're happy with the results, you can go ahead and configure any other web part options such as the layout. Make sure you save and/or publish your page once you're done.
Re-use your configured web part
If you have Atlas 3.1 or higher you can save the configuration of your web part to be reused on other pages or in other workspaces. To learn about this please see the linked article: Export and Import Settings for In Focus web parts
Comments
0 comments
Please sign in to leave a comment.