Hello Devnet,
I’ve been researching how to get PDF’s to show in the search result and have been making good progress.
I’ve run into a bit of a snag however, the link that shows up to the PDF in the results page is linking either to the root domain (if I select content only pages pagetype) or the page itself (If I select pages pagetype). But I want it to be a direct link to the PDF.
I took a look at the root pagetype and the smartsearchresults transformation.
Is there a way to have it detect whether or not the item is a content only pagetype or pdf and then allow that to be what links?
<div style="margin-bottom: 30px;">
<%-- Search result title --%>
<div>
<a style="font-weight: bold" href='<%# SearchResultUrl() %>'> <!-- THIS HERE! CAN THIS CONTAIN A CONDITIONAL THAT EITHER SHOWS THE URL OR THE MEDIA LIBRARY “PDF” URL? -->
<%#SearchHighlight(HTMLHelper.HTMLEncode(CMS.Base.Web.UI.ControlsHelper.RemoveDynamicControls(DataHelper.GetNotEmpty(Eval("Title"), "/"))), "<span style='font-weight:bold;'>", "</span>")%>
</a>
</div>
<%-- Search result content --%>
<div style="margin-top: 5px; width: 590px;">
<%#SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(CMS.Base.Web.UI.ControlsHelper.RemoveDynamicControls(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"), ""))), false, true, " ", "@", "")), 280, "...")), "<span style='background-color: #FEFF8F'>", "</span>")%><br />
</div>
<%-- Relevance, URL, Creattion --%>
<div style="margin-top: 5px;">
<%-- Relevance --%>
<div title="Relevance: <%# Convert.ToInt32(ValidationHelper.GetDouble(Eval("Score"), 0) * 100) %>%"
style="width: 50px; border: solid 1px #aaaaaa; margin-top: 7px; margin-right: 6px; float: left; color: #0000ff; font-size: 2pt; line-height: 4px; height: 4px;">
<div style='<%# "background-color:#a7d3a7;width:" + Convert.ToString(Convert.ToInt32(ValidationHelper.GetDouble(Eval("Score"), 0) * 50)) + "px;height:4px;line-height: 4px;" %>'>
</div>
</div>
<%-- URL --%>
<span style="color: #008000">
<%# SearchHighlight(SearchResultUrl(),"<strong>","</strong>")%>
</span>
<%-- Creation --%>
<span style="color: #888888; font-size: 9pt">
<%# GetDateTimeString(ValidationHelper.GetDateTime(Eval("Created"), DateTimeHelper.ZERO_TIME), true) %>
</span>
</div>
</div>
Any help would be much appreciated.
Thanks!