Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello all,
I have two sites running in one back office, and I want them to run the same template too. the only differences will be style changes.
I would like to know if there is a way to use the hostname deffined in cultures and hostnames to render style sheets...
<link rel="stylesheet" type="text/css" href="/css/Style.css"> @if (hostname) == test.example.com){ <link rel="stylesheet" type="text/css" href="/css/TestStyle.css"> }
Thanks in advance.
You can use the Site Name... which is the top level node name of the site and then...
@using ClientDependency.Core.Mvc @if(Model.Content.Site().Name == "Site1") { Html.RequiresCss("style1.css"); } else if(Model.Content.Site().Name == "Site2") { Html.RequiresCss("style2.css"); }
From there you can refactor or wrap it in something more elegant...
You really wouldn't want to tie it to the external dns because if you changed it you would have to change code.
Thanks Jeremy, That was what i was looking for. I ended up using the node Id instead of the name.
@if(Model.Content.Site().Id == 1090) { Html.RequiresCss("style1.css"); } ...
Glad to hear.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Condition based on hostname and cultures
Hello all,
I have two sites running in one back office, and I want them to run the same template too. the only differences will be style changes.
I would like to know if there is a way to use the hostname deffined in cultures and hostnames to render style sheets...
Thanks in advance.
You can use the Site Name... which is the top level node name of the site and then...
From there you can refactor or wrap it in something more elegant...
You really wouldn't want to tie it to the external dns because if you changed it you would have to change code.
Thanks Jeremy, That was what i was looking for. I ended up using the node Id instead of the name.
Glad to hear.
is working on a reply...