Trying to have a style sheet only used when the user is not on the home screen. This code in my head section should work, correct?

{if embed:loc != "home"}
<style> body {background:url(images/interface/header_bg_slice3.png) repeat-x,    
url(images/interface/texture_bg.png) top left, repeat;}</style>

here is the corresponding code I'm using in the page template:

{embed="embeds/html_header" page_title="About Us" loc="about-us"}

what am I missing?

  • 1
    Yes, that is correct, you are not missing anything. Is it not working for you when you inspect the source code of your page? Dec 27, 2012 at 23:09
  • This should be working. Have you tried {if "{embed:loc}" != "home"}? Does {embed:loc} output what you expect if you print the variable outside the conditional just to check?
    – Kevin Cupp
    Dec 28, 2012 at 15:56

3 Answers 3


Another option would be to avoid using embedded styles and add a class to your body tag based on what page is loaded. Then you can adjust your body background in your stylesheet instead of the templates.

Like vfalconi said, you can often base this off the index not having a segment:

<body{if segment_1} class="subpage"{/if}>

Then in your stylesheet:

.subpage { your styles here... }

Have you tried:

{if segment_1}...{/if}

In most cases, if the user is on the site index, there wouldn't be a segment_1. Just seems a much more straight-forward approach to what you're trying to achieve (from what I can tell).


Similar to what Jim said but this would give a bit more flexibility:

{embed="embeds/_html_head" body_id="your-css-id" body_class="your-css-class"}

and then within that embed

<body id="{embed:body_id}" class="{embed:body_class}">

You can also achieve the same thing with Low Vars (less overhead too)


where lv_html_head is a textarea Low Variable containing what would be in your embed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.