The problem is that the first 2 levels isn't clickable, and the 3nd level is the first that actually links to something usefull. Those 2 levels shouldn't be indexed if I understand the way a sitemap should work. And then i should have Hessel.dk on the top.
I haven't really used XSLT before, as I jumped directly into Razor, so it's kind of rubbish for me :-(
Hello, So am i right in saying that you want a site map for all level of your site and that the first two level are no clickable, thus will not have a <a href="url"></a>?.
can you post what umbracoNaviHide is (value and type) and also what $maxLevelForSitemap is (value and type). Some of the code above need refactoring.
You need to use a a <xsl choose><xsl:when select=""> statement. At the moment you are placing the xml with an <a></a> whatever it is and you only want to do this if is greate than level 2 in your structure.
Thanks Chriztian :). Out of intrest why have you got a a template topNode just to put a <ul> <li></li></ul> in or i am missing something? Thanks. Charlie.
Mostly because it makes it more obvious that it's actually getting a special treatment (URL is almost never the NiceUrl() result, nor is its name "Home" - in my solutions :-)
For the record, in my own solutions the "Home" node is always a document type called Website, and I just have a match template for that instead.
ahhhh ok :) just looking at that code i find it really hard to quicky see what its doing becuase its so seperated. ok :) we always have document types of HTML and then Default and then put all of the header information in the HTML template.
The overview thing is because you're still "thinking" in C# (or other "regular" programming language) terms — XSLT really works much more like CSS in many ways, but, unfortunately, xsl:for-each and xsl:choose tricks a lot of developers into thinking it's just another programming language :-)
I *do* use NiceUrl() - but not on the Home node, because I want the link to say href="/" - NiceUrl() will give me something like href="/ikea-dk" or similar.
What is the 'overview' thing? In any language you need people looking at the code to quickly understand whats going on, it just appears to add complexity. Thanks for the tip of not using the NiceUrl() in the home node, will bear that in mind :). Thanks. Charles.
Hierachy in Sitemap
First of all I'd like to state that I'm still a newbie to the world of Umbraco - so treat me kindly ;-)
I have a problem with my sitemap. The first 2 levels on each "main-node" should not be a link, as I only use it as way to "structure" my website.
You can see the sitemap here: http://www.hessel.dk/sitemap.aspx
The problem is that the first 2 levels isn't clickable, and the 3nd level is the first that actually links to something usefull. Those 2 levels shouldn't be indexed if I understand the way a sitemap should work. And then i should have Hessel.dk on the top.
I haven't really used XSLT before, as I jumped directly into Razor, so it's kind of rubbish for me :-(
Hello, So am i right in saying that you want a site map for all level of your site and that the first two level are no clickable, thus will not have a <a href="url"></a>?.
can you post what umbracoNaviHide is (value and type) and also what $maxLevelForSitemap is (value and type). Some of the code above need refactoring.
You need to use a a <xsl choose><xsl:when select=""> statement. At the moment you are placing the xml with an <a></a> whatever it is and you only want to do this if is greate than level 2 in your structure.
<ul>
<xsl:choose>
render the map but dont use an <a>
</xsl:when>
render the map an douse an <a> tag
</xsl:when>
</xsl:choose>
If you need some code post back and i will knock some up for you :)
</ul>
After two days of heartbreak i figured it out :-) You gave me some insight to how XSLT works. Thanks for that :-)
No problem :) glad i could help. What was the solution in the end? Thanks :) Charles.
Here is my end code :-)
Had to change some of the levels as I wasn't thinking clearly when i asked the question :-)
Brilliant :) well hope i helped a bit :D. Charles
Hi Jimmy & Charles,
Just for reference, here's my "match templates" approach to something like this (note that it's a quite different way of thinking):
/Chriztian
Thanks Chriztian :). Out of intrest why have you got a a template topNode just to put a <ul> <li></li></ul> in or i am missing something? Thanks. Charlie.
Hi Charlie,
Mostly because it makes it more obvious that it's actually getting a special treatment (URL is almost never the NiceUrl() result, nor is its name "Home" - in my solutions :-)
For the record, in my own solutions the "Home" node is always a document type called Website, and I just have a match template for that instead.
/Chriztian
ahhhh ok :) just looking at that code i find it really hard to quicky see what its doing becuase its so seperated. ok :) we always have document types of HTML and then Default and then put all of the header information in the HTML template.
How come you dont use NiceUrl()?
Charlie.
The overview thing is because you're still "thinking" in C# (or other "regular" programming language) terms — XSLT really works much more like CSS in many ways, but, unfortunately, xsl:for-each and xsl:choose tricks a lot of developers into thinking it's just another programming language :-)
I *do* use NiceUrl() - but not on the Home node, because I want the link to say href="/" - NiceUrl() will give me something like href="/ikea-dk" or similar.
/Chriztian
What is the 'overview' thing? In any language you need people looking at the code to quickly understand whats going on, it just appears to add complexity. Thanks for the tip of not using the NiceUrl() in the home node, will bear that in mind :). Thanks. Charles.
is working on a reply...