Copied to clipboard

Flag this post as spam?

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


  • molham bakir 18 posts 38 karma points
    Jul 17, 2013 @ 09:07
    molham bakir
    0

    .xslt is not showing

    .xslt is not showing only sitemap is showing! 

    I've followed this video http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/xslt-primer/creating-a-sitemap.aspx

    when i create a template, there's no text page template and in link to document there's is only sitemap as a hyperlink, not sitemap.xslt 

    why is that? 

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jul 17, 2013 @ 12:03
    Jan Skovgaard
    0

    Hi Molham and weclome to our :)

    What version of Umbraco are you using? The video you have seen is very old and since then the underlying XML structure has changed so the XSLT code you have written is probably targetting the old XML structure instead of the new one that got introduced in Umbraco 4.5.

    Have you setup document types and assigned templates to them youerself? Or have you installed a starter kit?

    Looking forward to hearing from you.

    /Jan

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 24, 2013 @ 13:51
    Dennis Aaen
    0

    Hi molham,

    Maybe you have solved this issue, but if not, I think you should take a look on the video. This is shows how to create a sitemap, using the new xml structure.

    http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/xslt-in-umbraco-45/creating-a-sitemap

    As Jan mentions in his post above a new XML structure got introduced in Umbraco 4.5 and all newer version of Umbraco.

    I hope this can help you further if, you haven't resolved your sitemap  issue already.

    /Dennis

  • molham bakir 18 posts 38 karma points
    Jul 24, 2013 @ 14:45
    molham bakir
    0

    I did the sitemap and its start working perfectly, however there's still a problem, which is for some reason it index all the pages i have buy not the home page?!! 

    why is that happening? 

     

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 24, 2013 @ 15:16
    Dennis Aaen
    0

    Hi molham,

    The reason you not getting the home page item out is because the sitemap XSLT is lists all the pages from level 1 which is below the homepage

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

    And it will list all the pages, until the when the level which defined in this variable. In the case below it will print nodes from level 1 to 4.

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

    One solution that I have seen often used is to hardcode a link to the frontpage if you want to included into the sitemap, this solution is also often used in context where you want to include link to the frontpage in a navigation.

    One way you could do it, is by code this snipet of code.

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

    <xsl:template match="/">
        <div id="sitemap">
            <a href="/">Fontpage</a>
            <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"/>
        <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 string(umbracoNaviHide) != '1' 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>
        </xsl:if>
    </xsl:template>

    Remeber if you are using my suggestion to change the maxLevelForSitemap variable to the level that you want.

    /Dennis

  • molham bakir 18 posts 38 karma points
    Jul 27, 2013 @ 10:37
    molham bakir
    0

    Sorry  i have no expertise in Umraco, where do i have to insert this code?

    thanks

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 27, 2013 @ 12:28
    Dennis Aaen
    0

    Hi molham,

    You have two differnt options here.

    1: Make a unique document type for sitemap and by that get a specific template, where you paste your macro for the sitemap in. I have made some screenshots for you I hope this can help you.

    First create the documentype

    Then go the section settings and find the templates foilder. I there you have a template called sitemap

    If you have a masterpage set it on, then it will inhert the design.

    Now just need to insert the macro.

    That was the first solution.

    2 soluton is more easy I think.

    You have make your XSLT file with a matching macro. Go to the delveloper settings find macros and then find the macro for the sitemap. I that you set tick in render content in  editor and use in editor. When you have done that. You go the Content section a added a regular page to the structure, maybe with the name Sitemp. I the field for the body text you click on this button and choose the macro for sitemap.

    Now you should see the content of the macro displayed on the page. 

    I know this a long post, but I hope this make sense I some way and you can use it even if you are new to Umbraco.

    /Dennis


Please Sign in or register to post replies

Write your reply to:

Draft