0

We are using managed navigation with a friendly urlsSo we have the following topics which are used both for tagging documents and for the friendly urls.

  • Topic 1
  • Topic 2

This creates a url like sitepath/topic-1 or sitepath/topic-2. There is one page in the pages library MyTopicPage.aspx which used for both of those urls. It shows a list of the documents that have been tagged with the appropriate topic. We do that with a content search web part (CSWP) and the query:

path:"{\Site}/Documents" owstaxIdTopic:{Term} (IsDocument:"True" OR contentclass:"STS_ListItem")

That is using the query variables I found in this blog to get the term used for the current navigation and search for items that have that value in the managed property created from the Topic managed metadata column. This works well and finds the correct documents.

But then I have some children pages like this:

  • site/topic-1/get-started
  • site/topic-2/more-about

Those pages have some other content, but I also want to have those pages include a content search webpart which shows documents that are tagged with the topic.

These child pages are in the termstore, but no documents are actually tagged with them. So owstaxIdTopic:{Term} doesn't work. That resolves to searching for something tagged with "Get started" and not with "Topic 1".

From that blog I found URLToken.# which will returns the parts of the url so for these children subpages.

  1. {URLtoken.1} -> get-started
  2. {URLtoken.2} -> topic-2

That would almost work, except "topic-2" doesn't match "Topic 2" so I don't get the results I expect.

Is there a way to get a {Term} query variable for part of the url above the current page? I was hoping there was something like {Term.parent}

This thread is the same/similar problem, but the solution isn't something I can implement. I'm only a Site Collection admin, so I can't add anything back end. I have to use the OOB webpart.

BTW there are actually 6 different topics and some documents might be tagged as being for multiple topics. So I'm looking for an idea that isn't too intricate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.