Copied to clipboard

Flag this post as spam?

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


  • claire 15 posts 36 karma points
    May 23, 2011 @ 09:03
    claire
    0

    in-built sitemap template not displaying 4.5.2

    Hi,

    I have created a new XSLT file using the in-built sitemap template and created a macro which uses this XSLT file. I have tried adding the macro to a content page but nothing is displayed. I've used the exact same process in another site and it works fine.

    I have duplicated the working sitemap exactly several times but I can't get it to display anything - any suggestions?

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2011 @ 09:10
    Fuji Kusaka
    0

    Hi Claire,

     

    When creating the site map did it create its own macro?

     

    //fuji

  • claire 15 posts 36 karma points
    May 23, 2011 @ 10:19
    claire
    0

    Yes it created a matching macro which I tried adding to the page content.

    Is it a requirement to have all the pages nested within a folder at the root level for the sitemap to display? Moving the pages to a folder fixed the problem.

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2011 @ 11:05
    Fuji Kusaka
    0

    Claire can you send me how you website is set up??

     

    Content

     Homepage etc....

     

    fuji

  • claire 15 posts 36 karma points
    May 23, 2011 @ 11:35
    claire
    0

    Hi Fuji,

    Site structure below:

    Content
    -- Home
    -- Folder1
    ---- About
    -------- About 1
    -------- About 2
    ---- Projects
    -------- Project 1
    -------- Project 2
    ---- Contact
    ---- Privacy 

    The sitemap only appears when I have the pages within Folder1. The Home page needs to be outside of this (and be the first page at root level) for the default page to display correctly. So the Home page doesn't actually appear in the sitemap which isn't what I wanted but at least the rest of the site is displayed.

    Any ideas what I'm doing wrong?

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2011 @ 11:52
    Fuji Kusaka
    0

    OK i have the same strucuture  quite the same structure as yours.

    You can try this out

     

    <!-- update this variable on how deep your site map should be -->
    <xsl:variable name="maxLevelForSitemap" select="4"/>

    <xsl:template match="/">
    <div id="">
      <xsl:call-template name="drawNodes">  
        <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>  
      </xsl:call-template>
    </div>
    </xsl:template>

    <xsl:template name="drawNodes">
    <xsl:param name="parent"/>
      <!-- Testing for protection -->
      <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
    <ul>
       <xsl:for-each select="$parent/* [@isDoc and @level &lt;= $maxLevelForSitemap]">
    <li>  
      <a href="{umbraco.library:NiceUrl(@id)}">
      <xsl:value-of select="@nodeName"/></a>  
      <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">   
        <xsl:call-template name="drawNodes">    
          <xsl:with-param name="parent" select="."/>    
        </xsl:call-template>  
      </xsl:if>
    </li>
        
    </xsl:for-each>
    </ul>
  • claire 15 posts 36 karma points
    May 24, 2011 @ 01:18
    claire
    0

    Thanks for the reply Fuji. Tried replacing my code with yours but I still get an empty listing :(

  • Fuji Kusaka 2203 posts 4220 karma points
    May 24, 2011 @ 06:58
    Fuji Kusaka
    0

    Hi Claire,

     

    Can you paste your code down here to have a look?..that's weird you are not getting anything?.....are you calling your macro  in your template or in a richTexteditor?

     

    //fuji

  • claire 15 posts 36 karma points
    May 25, 2011 @ 01:03
    claire
    0

    Hi Fuji,

    The macro is added to a page with the RTE via the Insert Macro icon. The xslt file contents:

    <!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"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

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

    <xsl:param name="currentPage"/>

    <!-- update this variable on how deep your site map should be -->
    <xsl:variable name="maxLevelForSitemap" select="4"/>

    <xsl:template match="/">
    <div id="">
      <xsl:call-template name="drawNodes">  
        <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>  
      </xsl:call-template>
    </div>
    </xsl:template>

    <xsl:template name="drawNodes">
    <xsl:param name="parent"/>
      <!-- Testing for protection -->
      <xsl:if test="umbraco.library:IsProtected($parent/@id,
     $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id,
    $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
    <ul>
       <xsl:for-each select="$parent/* [@isDoc and @level &lt;= $maxLevelForSitemap]">
    <li>  
      <a href="{umbraco.library:NiceUrl(@id)}">
      <xsl:value-of select="@nodeName"/></a>  
      <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0 and $currentPage/showInSiteMap = 1">   
        <xsl:call-template name="drawNodes">    
          <xsl:with-param name="parent" select="."/>    
        </xsl:call-template>  
      </xsl:if>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

    The structure of my site is the same as posted above.

     

     

     

  • Fuji Kusaka 2203 posts 4220 karma points
    May 25, 2011 @ 10:23
    Fuji Kusaka
    0

    HI Claire,

    I have just tested your sitemap code in an XSLT and it is returning me all the links nodes under this structure/

    - Content

    -- HOME

    --- Page 1

    --- Page 2

    --- Page 3

     

    //fuji

  • claire 15 posts 36 karma points
    May 26, 2011 @ 01:41
    claire
    0

    Thanks for the reply Fuji. I would like my home page to be at the same level as the other pages. Is it by design that all pages need to be created as child nodes of the home page?

    For example, why doesn't the sitemap work when I have this structure:

    -Content
    --Home
    --Page1
    --Page2
    --Page3

Please Sign in or register to post replies

Write your reply to:

Draft