Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • syn-rg 282 posts 425 karma points
    Dec 11, 2012 @ 07:13
    syn-rg
    0

    How to exclude umbracoRedirect items being displayed in results

    How can I exclude pages that have been redirected using "umbracoRedirect" from displaying in the search results?

    <xsl:variable name="possibleNodes" select="$items/descendant-or-self::*[
                                 @isDoc
                                 and string(umbracoNaviHide) != '1'
                                 and name() != 'ImageGalleryPhoto' <!-- Hide doctype from search -->
                                 and string(umbracoRedirect) != '1'
                                 and count(attribute::id)=1
                                 and (umbraco.library:IsProtected(@id, @path) = false()
                                  or umbraco.library:HasAccess(@id, @path) = true())
                               ]"/>

     

  • Drew 165 posts 340 karma points
    Dec 11, 2012 @ 09:26
    Drew
    0

    The XML value stored against a page with umbracoRedirect (in this case a property called 'umbRedirect' contains a node ID, like so:

    1068

    So, you need a check to make sure to exclude any page where that value exists, so something like:

     and string-length(umbRedirect) = 0

     

    Cheers,
    - Drew 

  • Chriztian Steinmeier 2798 posts 8787 karma points MVP 7x admin c-trib
    Dec 11, 2012 @ 09:44
    Chriztian Steinmeier
    1

    Hi JV,

    I'd rewrite that whole expression as the following:

    <xsl:variable name="possibleNodes" select="
        $items//*[@isDoc]
        [not(umbracoNaviHide = 1)]
        [not(self::ImageGalleryPhoto)]
        [not(normalize-space(umbracoRedirect))]
        [not(umbraco.library:IsProtected(@id, @path)) or umbraco.library:HasAccess(@id, @path)]
    " />

     

    /Chriztian

  • syn-rg 282 posts 425 karma points
    Dec 12, 2012 @ 00:32
    syn-rg
    0

    Thanks Chriztian, that works perfectly! Cheers!

Please Sign in or register to post replies

Write your reply to:

Draft