I have the managed navigation functionality activated in my publishing site on SharePoint 2013, which enables the creation of friendly URLs for pages by using the term store.

Now I am working in a data view webpart that queries the Pages library in this website and I would like to get the friendly URL for the returned pages. Although I have access to the @FileRef property, it gives me only the physical path of the item (e.g. /my-site/Pages/my-page.aspx), and I would like to access the friendly URL (/my-site/my-page).

Is there any procedure I can do to get access the friendly URL of the page in a data view web part?


Unfortunately only replacing the Pages and the .aspx parts of the URL won't solve the problem. SharePoint allows to create custom friendly URL's that won't match the file name of the page, and there are many cases the users will do that.

3 Answers 3


I think the friendly URL is stored in the catalog, not the page itself.

You'd probably be better off using a Content Search Web Part (in most cases). It's the "new" way to do DVWP-like stuff, but it's also different tech than you are used to. You can build your own Display Template that sits underneath the CSWP to display the data.

  • An example will be helpful.. I'm interested to know this new way too :P Commented Jan 17, 2014 at 21:10
  • Arsalan: There's pretty good documentation about Content Search Web Parts out there. I'd suggest starting here: msdn.microsoft.com/en-us/library/office/jj163789.aspx Commented Jan 18, 2014 at 0:29
  • The Content Search Web Part relies on the search service, right? So in this case, would I have to wait the pages to be indexed to be shown? Is it possible to use CSWP-like display templates in CQWP? Commented Jan 20, 2014 at 12:17
  • That's correct, @GuilhermeSehn. The CSWP uses the search index. No, you cannot use Display Templates with the CQWP; it works the same as before. Commented Jan 20, 2014 at 20:59

You could always do some substring functions to get the pieces, that might get a little messy, and put it back together or a translate function.

<xsl:value-of select="translate(@FileRef, '/Pages', '')" /> 
  • Unfortunately this method won't work in every page. I edited the question to explain why. Commented Jan 17, 2014 at 11:10

You can use the following 2 xslt tags:

<xsl:value-of select="substring-before(@FileRef, '/Pages')"/><xsl:value-of select="substring-after(substring-before(@FileRef, '.aspx'), '/Pages')"/>

You may have to tweak depending on your URL structure, but in general you will have to conquer the problem in the manner above.

  • Unfortunately this method won't work in every page. I edited the question to explain why. Commented Jan 17, 2014 at 11:09

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.