Hi there.. I'm sorry if there is already a thread out there with an answer to this.. I've searched and searched, but have gotten no results :(
I am looking for a way to change the display in my search results.
I have the correct searchFields and previewFields set up for my needs, and the results works in the correct manner, but I need to do 1 thing.
Right now it displays my content article/magazine name / the node's name, but I want it to show the first property the article/magazine has which is "homepageArticleTitle" and "magazineTitle".. How do I do this?
I've been playing around with razor for some time now, but not with XSLT very much.. So if you can help me it is much appreciated :-)
<!-- page name and url -->
<a href="{umbraco.library:NiceUrl(@id)}" class="xsltsearch_title">
<xsl:value-of select="@nodeName"/>
</a>
and change it to this:
<!-- page name and url -->
<a href="{umbraco.library:NiceUrl(@id)}" class="xsltsearch_title">
<xsl:value-of select="homepageArticleTitle" />
<xsl:value-of select="magazineTitle" />
<!-- Fallback to nodeName if necessary -->
<xsl:if test="not(normalize-space(homepageArticleTitle)) and not(normalize-space(magazineTitle))">
<xsl:value-of select="@nodeName" />
</xsl:if>
</a>
Provided your documents have eitherhomepageArticleTitleormagazineTitle this will work fine - if your document has both, you'll need a little extra checking - let me know if that's the case.
Display Property instead of nodeName
Hi there.. I'm sorry if there is already a thread out there with an answer to this.. I've searched and searched, but have gotten no results :(
I am looking for a way to change the display in my search results.
I have the correct searchFields and previewFields set up for my needs, and the results works in the correct manner, but I need to do 1 thing. Right now it displays my content article/magazine name / the node's name, but I want it to show the first property the article/magazine has which is "homepageArticleTitle" and "magazineTitle".. How do I do this?
I've been playing around with razor for some time now, but not with XSLT very much.. So if you can help me it is much appreciated :-)
Ask me for anything, if something isn't clear ;)
Hi David,
Locate the following in the
XSLTsearch.xslt
file:and change it to this:
Provided your documents have either homepageArticleTitle or magazineTitle this will work fine - if your document has both, you'll need a little extra checking - let me know if that's the case.
/Chriztian
Sorry, I haven't responded before this time. It works great, and I very much appreciate your time!
HIGHFIVE
is working on a reply...