This is part 3 of a multi-part series on configuring Cross-Site publishing in SharePoint Online.
- Let’s Play Ball! XSP in SPO [Part 1]
- Let’s Play Ball! XSP in SPO [Part 2]
- Let’s Play Ball! XSP in SPO [Part 3]
Note: at the time of this writing, Cross-site Publishing is available in the Education, E3, E4, and E5 plans of Office 365.
Continuing with our example of building a Baseball Player Catalog, it’s now time to connect to our published catalog from the consuming site and set up the pages to show the player information via Search web parts.
Remember we have previously added our team members as items into one of three content types (Coaches, Front Office Staff, Players) to the baseball team list on the authoring site collection and crawled the content. Below is a screenshot to indicate this is just a regular custom list that the content authors will use to keep the player catalog up-to-date.
NOTE: I am not an experienced branding resource. I will show the basics of how you can customize search web parts to show the 3 types of content (Players/Coaches/Front Office Staff). You are only limited by your imagination and the expertise of your branding resource on how you want your returned search results to look.
STEP 1: Connect to the Baseball Team Catalog on the consuming site by navigating to Site Settings…Site Administration…Manage Catalog Connections.
STEP 2: Configure the catalog connection settings from the settings page as follows:
Auto-Generated Pages Explained
…whereas the catalogitem page will be restricted by the navigation term of current page and will have an additional filter configured that will pull the unique ListItemID from a URL token as follows:
The friendly URLs are generated based on the settings defined in the authoring site collection when the list was published as a catalog. The setting below in the Content Search web part query settings should already be selected based on that:
STEP 3: Verify Managed Properties previously created.
- Map to a crawled property
- Select the ‘Retrievable’ and ‘Safe’ options for sure on each managed property.
- In SharePoint Online I’ve also selected both ‘Searchable’ and ‘Queryable’ options on the managed property and have had success with that although I’m not sure they are required.
Re-crawl both the SharePoint list and site to pick up these changes. Once the content has been re-indexed you should now see all of these managed properties when you are customizing the search web parts.
STEP 4: Create Custom Display Templates
- Add all new managed properties you want to show in your search results to the <mso:ManagedPropertyMapping> section at the top of the display template.
Upload your custom display templates to the MasterPage gallery in the Display Templates/Content Web Parts folder and ensure they are approved.
STEP 5: Create Custom Category and Item Pages
Create a custom category page using the Category-TeamList page layout. Your page layout will be Category-TermSetName. By selecting this page layout, the breadcrumb navigation and search webpart will already be configured for you.
Edit the $Resources:cms,WebPartZoneTitle_Dynamic webpart on the page and adjust the display template setting to your custom template: (in our example, the custom display template name is Player Pick on top, 3 lines on bottom.
Create a custom catalog item page using the same page layout (Category-TeamList). I find this works well as it retains the breadcrumb navigation at the top of the page.
Edit the $Resources:cms,WebPartZoneTitle_Dynamic webpart on the page and change the query to have this configuration: (the unique ListItemID is retrieved from the URL to ensure we will only retrieve the 1 item selected)
You also need to adjust the display template so it points to your custom template: (in our example, the custom item display template is Player Pick on left, 3 lines on right.
STEP 6: Point Navigation to Custom Pages
Now that you have built your custom pages, you need to connect them to your navigation terms since the auto-generated pages are currently connected. To do this, you go to Site settings…Term store management on the Consuming site collection.
In SharePoint Online, you need to change this setting in several places in the Site Navigation within the term store.
Term-Driven pages at the Site Navigation level:
Term-Driven pages at each top-navigation term level: (Coaches/Front Office Staff/Players):
Once you’ve done this, your custom pages will show when you click on any of the navigation terms on the consuming site collection.
STEP 7: Work is Done!
Here is an example of my custom category page when the Players term is selected from the navigation. You can see it displays all items underneath that term including all items associated to any of its child-terms using the custom category display template:
If you select a child navigation item (Players…Infield for example), the display is automatically filtered to only items for the Infield term and this is what you’ll see using the same custom category display template:
…and if you select the infielder, Johnny Quick, from above, here is the custom catalog item page that is displayed using the custom catalog item display template:
Well that’s pretty cool! We’ve isolated the authoring of the content from the look-and-feel of the content. Content authors update information about team members on a custom list in one site collection and with some configuration and branding we surface the content in another site collection driven by term navigation and the power of SharePoint Search!
There are some nuances between building this solution in SharePoint Online compared to an on-premises SharePoint environment. In the next post I’ll discuss some of these differences and some lessons learned along the way.
Thanks for reading!