I have a requirement where I need to customize the display of content in a content query web part based on metadata associated with the page layout. When I say customize the display I am not filtering out content. Its a navigational element of sorts. Essentially I have a page that talks about a specific topic. My web part will conditionally format all of the items that pertain to that particular item, it will also gray out the options that do not pertain to that item, but will leave them clickable.

Is there a way to grab the current page title as a parameter in the itemstyle.xsl? I know I can grab the current URL, and worst case scenario I could strip out the page title based on that, but I am then relying to much on the end user to create the page correctly. I also know I could use jquery or javascript to get the title, however one of the requirements is to avoid as much code even client side as possible.

1 Answer 1


Looking at this, I'd try to use the function OuterTemplate.GetPageNameFromUrl as you can pass the URL of the current page and you will get the page name for that URL.

  • Its not looking like this function grabs the page title though, looks more like it just gives you the page url. I just used the Outer.Template.GetPageNameFromUrlRecursive which is called from the Outer.Template.GetPageNameFromUrl. It essentially does a substring-after /. I could probably do a transform on this to get the value I want but thats relying a lot on the end users. Thanks for the tip, it got me going in the right direction.
    – Cory
    Commented Feb 27, 2013 at 18:23
  • Too bad it was such a dummy function, was hoping it to be bit more sophisticated. :(
    – Jussi Palo
    Commented Feb 27, 2013 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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