Copied to clipboard

Flag this post as spam?

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


  • Frost 70 posts 99 karma points
    Feb 16, 2012 @ 21:32
    Frost
    0

    XSLT - Filter Specific Document Types

    Is there a way to apply changefreq and priority to all documents of a certain document type? We will be creating a dozen articles a day and I don't want to have to manually set each article's changefreq and priority.

    I added the searchEngineSitemapChangeFreq and searchEngineSitemapPriority properties to all document types, and where I enter something manually it works great.

    It seemed best to go about this in the XML file. I tried to add an xsl:if that would call the document type by alias, but that doesn't seem to work.

    <xsl:if test="./data [@nodeName = 'uBlogsyPost']">
      <changefreq>monthly</changefreq>
    </xsl:if >  

    I also desperately tried to set these values for anything that didn't have searchEngineSitemapChangeFreq, but that didn't work either.

                <xsl:if test="./data [@alias='searchEngineSitemapChangeFreq'] = '' or searchEngineSitemapChangeFreq = ''">
                  <changefreq>
                    monthly
                  </changefreq>
                </xsl:if

    What's the right way to do this?

    Thanks!

  • Jan Skovgaard 11244 posts 23437 karma points MVP 6x admin c-trib
    Feb 16, 2012 @ 23:37
    Jan Skovgaard
    0

    Hi Frost

    What version of Umbraco are you using? Since you're using uBlogsy I suspect you use Umbraco at least Umbraco 4.6 and the XML schema you're trying to match appears to be the legacy schema, which could be why the above examples does not work.

    Looking forward to hear more about this.

    /Jan

  • Frost 70 posts 99 karma points
    Feb 17, 2012 @ 01:03
    Frost
    0

    Oops, forgot to put that on again, sorry! U 4.7.1, and how exactly do you determine the schema? (Sorry for not knowing.)

    Here's part of the XSLT, in case that helps.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
      <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:umbraco.contour="urn:umbraco.contour"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour ">

      <xsl:output method="xml" omit-xml-declaration="yes"/>

      <xsl:param name="currentPage"/>
  • Thomas Egebrand Gram 63 posts 134 karma points
    Jan 25, 2013 @ 12:14
    Thomas Egebrand Gram
    0

    Hello Frost,

    I'm sure you've figured out by now, as it's nearly been a year, but just to clarify for those who might drop by this when searching, i'll explain the solution.

    Exclude a doctype from Cultiv Search Engine Sitemap:

    In order to exclude a doctype, you will firstly have to know it's alias.You can view it inside the settings - on the doctype you've created.

    1. Go to the developer section, and open the XSLT file CultivSearchEngineSitemap.xslt
    2. At line 39, you will see something like this:
      <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1'] | $parent/node [string(./data [@alias='umbracoNaviHide']) != '1']">
    3. Change this line to
      <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and name() != 'Video'] | $parent/node [string(./data [@alias='umbracoNaviHide']) != '1']">

    And voila! The document type with the alias Video will now be excluded from the sitemap.

    // Thomas G

Please Sign in or register to post replies

Write your reply to:

Draft