I'm looking for the canonical way to take advantage of the content block being processed ahead of the head block to let a UDT or other tag in the content block append additional styles or scripts to a page's head block at runtime.
My fallback method would be to have one or more placeholder tags templated into the head block that examine variables set by the worker tag in the content block. Obviously this isn't just for the thrill of doing it; I'd take a more static approach if it were appropriate in the larger context.
Is this fallback method in fact the best way of accomplishing that? Or what should I be exploiting something in the API to do it programmatically? I have looked at the docs and examined the particular contentObject in question, but so far I don't see a more straightforward solution.
(FWIW I notice most of the big news sites don't even bother putting such item-related data in the head block any more but inject it into the middle of the body text just before using it.)
Appending lines to meta/head text from content block
-
- New Member
- Posts: 6
- Joined: Tue Nov 11, 2014 6:43 pm
Re: Appending lines to meta/head text from content block
Have you tried the metadata box in the Options tab of the page..?
-
- New Member
- Posts: 6
- Joined: Tue Nov 11, 2014 6:43 pm
Re: Appending lines to meta/head text from content block
Thanks for getting back, but the metadata in question isn't always known at edit time, and in any case the tag implementing this needs to be more plug-and-play in the content block than that.
I've proceeded with two tags in the template, each inspecting a session variable for run-time additions to styles or js requested by tags in the page content. After more investigation, that seems to be the simplest and most direct method.
I've proceeded with two tags in the template, each inspecting a session variable for run-time additions to styles or js requested by tags in the page content. After more investigation, that seems to be the simplest and most direct method.