I’m trying to put an <esi:include src=…/> tag into my <head> section, so I defined this expander first:
html_write:expand(esi(Handler)) -->
{ http_link_to_id(Handler, [], HREF) },
"<esi:include src=\"", [HREF], "\"/>".
Then I modify the ‘sheets’ page style to include this in the header
user:head(sheets, Head) -->
html([ \html_receive(head),
Head,
esi(shared_head_esi),
meta(two)
]).
I render the page like this:
sheets_homepage(Request) :-
reply_html_page(
sheets,
title('Sheets'),
[ \header_fragment(Request),
\body_fragment(Request),
\footer_fragment(Request)]).
The result is that the esi-tag is put into the body-tag and wraps everything in there, which doesn’t make sense. (BTW: the expander always creates <esi:...></esi:...> tag pairs but I just need a single <esi: .../> tag. Luckily the upstream processor seems to handle it. How do I generate single tags?)
I experimented a bit and it seems to me that the library throws out the tags it doesn’t want in the head!?! If so, how do I overwrite this behavior? How else could this be done?
I tried debugging but it does’t enter into the expansion process (presumably it’s written in C?).
Lesson: use “View source” during development!