I'm very busy with a project that haves multiple websites in one umbraco setup, but I have a little problem with the following thing.
I want to use one master-template and therefore I only want to change the source of the css file dynamically/appendable on the sitename or nodename from the website. Now I have created the following XSLT and it works on the homepage, but when I select a childnode it will load no style.
Now I know with my xslt's it always select the nodename of the current node, but I want to select the website/root node.
I'm a newbie in Umbraco and xslt, so please go easy on me ;-) and please help me on this one.
Are you planning on changing the css style through the backend? I did something alike by using dataType where the client can change the colorscheme of its homepage with predefine style.
That's not necessary because every new website that will be created, must have it's own colors/colorscheme that's not the same as the others and not only the colors will be different, but also the layout.
- assuming all pages in your website are descendants of your frontpage. Substitute "Frontpage" in the first line with the nodeTypeAlias of your frontpage / root node.
Thanks for your reply, but I tried it. But i'm not sure what you mean with nodeTypeAlias. When I use your solution and change 'frontpage' in the rootname. I get in the browser the following code:
Select css by nodename with multiple websites
Good day,
I'm very busy with a project that haves multiple websites in one umbraco setup, but I have a little problem with the following thing.
I want to use one master-template and therefore I only want to change the source of the css file dynamically/appendable on the sitename or nodename from the website. Now I have created the following XSLT and it works on the homepage, but when I select a childnode it will load no style.
Now I know with my xslt's it always select the nodename of the current node, but I want to select the website/root node.
I'm a newbie in Umbraco and xslt, so please go easy on me ;-) and please help me on this one.
<xsl:for-each select="currentPage">
<link rel="stylesheet" type="text/css" href="/css/{@nodeName}.css"/>
</xsl:for-each>
Hi Niels,
Are you planning on changing the css style through the backend? I did something alike by using dataType where the client can change the colorscheme of its homepage with predefine style.
If you want something like that let me know.
//fuji
@Fuji
That's not necessary because every new website that will be created, must have it's own colors/colorscheme that's not the same as the others and not only the colors will be different, but also the layout.
But thank you very much for your input.
Hey Niels,
This should work:
- assuming all pages in your website are descendants of your frontpage. Substitute "Frontpage" in the first line with the nodeTypeAlias of your frontpage / root node.
Hey Medjeti,
Thanks for your reply, but I tried it. But i'm not sure what you mean with nodeTypeAlias. When I use your solution and change 'frontpage' in the rootname. I get in the browser the following code:
<link href="/css/.css" type="text/css" rel="stylesheet">
So there is no filename defined before .css
My projects structure is like this:
Content
|_Website 1
|_Page/Childnode 1
|_Page/Childnode 2
|_Page/Childnode 3
|_Page/Childnode 4
|_Website 2
|_Page/Childnode 1
|_Page/Childnode 2
|_Page/Childnode 3
|_Page/Childnode 4
|_Website 3
|_Page/Childnode 1
|_Page/Childnode 2
|_Page/Childnode 3
|_Page/Childnode 4
The NodeTypeAlias is the Alias property of a given Document Type (you can see this value on the DocType's configuration page in the Settings section).
In your case this will be the DocType of your website root nodes (Website 1, Website 2 etc.).
So, if your DocType has an alias of "WebsiteRootPage", the code would be:
Yes! Your the hero of the day, feel myself pretty stupid, but learning in progress! Thank you very much!
Any time :o)
is working on a reply...