Ok so we want to change the body tag id depending on which page we are on.
This raised a couple of solutions with pros/cons:
* Add a field to the page's data type which holds the id name, simple but users have access to it and could mess up the site. Is there a way to hide some fields only for admins?
* Have a new master page section just for the body id, over kill really but at least only admins/developers could mess with it
* Work out the id based on the currently template/data type. Not all the pages have CSS id friendly names so we could need a way of converting it to a machine readable name (eg convert "About us" to "about_us" or similar) which is doable but a pain and its possible for it to go wrong if someone changes a name of a template/data type
* Simply have a XSL choose statement in a macro that adds in the id depending on some logic regarding current template, similar to above but hard coded logic in one place.
I created an XSLT which takes the section node name and replaces the spaces with a hyphen. It may not be the best solution but it was a simple solution for the site I built:
body tag id's where best to put them in the back end?
Ok so we want to change the body tag id depending on which page we are on.
This raised a couple of solutions with pros/cons:
* Add a field to the page's data type which holds the id name, simple but users have access to it and could mess up the site. Is there a way to hide some fields only for admins?
* Have a new master page section just for the body id, over kill really but at least only admins/developers could mess with it
* Work out the id based on the currently template/data type. Not all the pages have CSS id friendly names so we could need a way of converting it to a machine readable name (eg convert "About us" to "about_us" or similar) which is doable but a pain and its possible for it to go wrong if someone changes a name of a template/data type
* Simply have a XSL choose statement in a macro that adds in the id depending on some logic regarding current template, similar to above but hard coded logic in one place.
Any one got any pointers?
Hi Peter,
I would add a property, and try to hide it for most users. One way just by placing it on an "advanced" tab, better way to use the "disabled properties" package http://our.umbraco.org/projects/axendo-disabled-properties
I guess it would be good to also use standard properties. http://our.umbraco.org/projects/standard-values-in-umbraco
Regards
Jonas
Hi Peter,
I created an XSLT which takes the section node name and replaces the spaces with a hyphen. It may not be the best solution but it was a simple solution for the site I built:
Hope that helps.
Ian
is working on a reply...