How do I conditionally include JavaScript in the head from a specific template file? #10705
Answered
by
ryanmitchell
RyanRoberts
asked this question in
Q&A
-
What’s the best way to include some JavaScript in the head of my document (the head being in the main layout file) from a specific template file? For example, I have an article template, and only pages using that template need this specific JavaScript. I’d rather not have it load on other pages, in fact the JavaScript might not even be needed at all if the site’s owner doesn’t use a particular block that relies on it (it's a Lightbox image popup thing). |
Beta Was this translation helpful? Give feedback.
Answered by
ryanmitchell
Aug 27, 2024
Replies: 1 comment 2 replies
-
Stacks are the way to go: https://statamic.dev/antlers#stacks |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
RyanRoberts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stacks are the way to go: https://statamic.dev/antlers#stacks