Skip to content

How to make a conditional header for loading JS/CSS files? #617

Discussion options

You must be logged in to vote

@jonscrut

i use my own layouts (so they aren't affected by updates)
and i display slides on the home page only...
I use a layout for the home page and use php to include the slides layout

<?php if(($this->yellow->page->get("Layout")) == "home") : echo $this->yellow->layout("slides"); endif; ?>

and the slides "layout" has its own HTML PHP and inline javascript

While this is not adding it to the head as requested, you may be able to experiment with using the "layout" check in the "head"
So that when you want the CSS and JS added to the page you may be able to add...

Layout: blog-dataviz

to your page,

this solution would keep the code out of the mark-down

Replies: 4 comments 18 replies

Comment options

You must be logged in to vote
4 replies
@markseuffert
Comment options

@textplusdata
Comment options

@markseuffert
Comment options

@markseuffert
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@markseuffert
Comment options

@GiovanniSalmeri
Comment options

@markseuffert
Comment options

@markseuffert
Comment options

@nzyeehaa
Comment options

Comment options

You must be logged in to vote
6 replies
@nzyeehaa
Comment options

@textplusdata
Comment options

@nzyeehaa
Comment options

@textplusdata
Comment options

@nzyeehaa
Comment options

Answer selected by annaesvensson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants