Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 36188

Using Content by Search (CBS) to Read the current page URL and Match to a MMS Term Set

$
0
0

Hi all,

So I am working with a customer this week to assist them on their SharePoint 2013 Design and Architecture for their Intranet. One requirement that we had to figure out how to do was how can we use a CBS to read the URL of the page that resides in and match that to a term in MMS. So to recap:

1. We have a lot of authors creating Pages and List Items.

2. We are creating a Term Set in MMS so these authors can tag their content based on the language of the content.

3. We have various sub-sites in our farm where users will go to in their languages.

4. We want to pull all content that has been tagged based on the sub-site that the user is in and put that on the page.


So we decided to use the awesome new Content By Search (CBS) web part to pull all content that has been tagged and put that on the page. The issue we ran into was how we do only show the content that has been tagged to the sub-site they are in. So in other words, match the URL to the content that has been tagged. So we researched this and here is how we did it:

Here is the query to for Content Search web part that pulls the URL (we have URLs that match language sub-site that the user is currently in) and matches it to content that users have tagged with the language. The query is:

owstaxId<name of location MMS managed property>:{URLToken#}

Where # is the number of tokens in the URL from the right. For example, a URL of http://testmachine/sites/vancouver/english/pages/welcome.aspx would have the following token structure:

Welcome.aspx = URL token 1

/Pages/ = URL Token 2

/English/ = URL Token 3

And so on…

Below is the picture of this CBS:

 

 

 

 

Enjoy....

Mike


Viewing all articles
Browse latest Browse all 36188

Trending Articles