I’m using a theme which has the following files:
layouts/partials/header.html– the part provided by the theme
layouts/partials/head_custom.html– for adding own scripts etc.,
Also, I have created some shortcodes which need specific JS libraries. So far, they are all included in
head_custom.html for every page. But the shortcodes are not used on every page!
So, my idea is the following:
- Set a variable in the shortcodes (
- Check in
head_custom.htmlfor the presence of this variable
- Only if variable is present, include library.
Is this possible somehow? I could not achieve it so far.
If there is a forum question for this already, I’m sorry that I haven’t found it yet; however, most similar entries seem to suggest a solution by manually setting front matter information, which I do not want.