SharePoint 2013 – The Path has lost its way for Markdown files within SharePoint search

Today I created a display template within SharePoint 2013 site showing document that are checked out to me. All easy until I created a mix of publishing and team sites.

Within my display template I was using the following line to create a check in button next to my document name:

<button id="tr-checkin" style="float: right;" type="button">Check in</button>

The Url in ctx.CurrentItem.Path for my documents in team site would look like this:

http:/ /myspdev/subsite/team/Shared Documents/Doc1.docx

All great!

But then when I added a checked out document to a team site. I found that my url for the document was set to the display form rather than the document url:

http:/ /myspdev/subsite/Shared%20Documents/Forms/DispForm.aspx?ID=1

So I updated my display template  to point the use to the edit form using the link to the display form. At least there is a checkin button there:


&lt!--#_ if (path.indexOf("ID=") !== -1) { #-->
&lta id="tr-checkin" style="float: right;" href="
#= ctx.CurrentItem.Path =#"&gtCheck in&lt/a&gt
&lt!--#
} else { #-- >
&ltbutton id="tr-checkin" style="float: right;" type="button">Check in</button&gt
&lt!--#
} _#--&gt

So it looks like  there are more differences between publishing libraries and non publishing libraries than expected. I had a look through other crawled properties within the search configuration, but couldn’t find anything that points to the document within my team sites.

Not wanting to be beaten that easily I created some more sub sites and then I found that some of my team sites were returning the right url. So could the issue be related to something else?

In the above screenshot the readme file is a .md file. So it looks like Markdown files are not handled properly within the SharePoint search engine.

 

 

 

 

 

 

 

Advertisements

2 thoughts on “SharePoint 2013 – The Path has lost its way for Markdown files within SharePoint search

  1. My guess is that SharePoint is being “helpful” for file extensions it can’t open in the browser. But in your case, it’s not so helpful.

    M.

    Like

    1. Hi Marc,
      Indeed. I’m not sure though why this depends on the file format. So far I’ve seen the issue with Markdown. At least most common office file formats don’t seem to cause any problems.

      Like

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.