I know how to use parameters in content query web parts. Is there any option to filter a list by the site URL only? Like if I am on /customers/customer1 I would like to see details for customer1. The idea behind this is that I could put one webpart on these pages, the same for everyone, that would work for all customers. Any idea is appreciated. Thanks.

  • To understand, how are these links created - manually or navigation using pages? Mar 27, 2017 at 8:07
  • There is a "customers" site and under it there is one subsite for each customer.
    – vilmarci
    Mar 27, 2017 at 8:09
  • What is this standard webpart - OOB webpart or custom created server side webpart? Mar 27, 2017 at 8:15
  • On standard, I mean the same for every customer. I will clarify the question. I am looking for an OOB solution, as I only have site collection admin rights.
    – vilmarci
    Mar 27, 2017 at 8:21

1 Answer 1


There will not be any pretty solutions with the constraints that we have here. With OOB, we will need to do ugly hacks like:

  1. Change navigation mode to manual and add url with querystring parameter as needed e.g. &burl=customer1 and then use querystring filter on pages to access it.

  2. Add javascript code on pages which will check if page has that querystring, if not then it will redirect page to same url but with additioinal querystring parameter.

It will be much cleaner if there is option to add a custom created filter webpart OR redesign site structure to use Cross Site Publishing.

  • 1
    Option 1 is not really ideal, as the users still could change the url by hand or use outdated links. How would option 2 look like? Is it possible to add the redirect script in the master page, so I wont't need to redesign all of the several hundreds of customer pages?
    – vilmarci
    Mar 27, 2017 at 10:17
  • It can be added to masterpage. script will check if parameter is present in the url. If not then create url with parameter. Following link can be of help. stackoverflow.com/questions/901115/… Mar 27, 2017 at 10:32
  • Great, thank you, the javascript method is working.
    – vilmarci
    Mar 27, 2017 at 15:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.