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