I have a Wicket application that contains a lot of Javascript in the headers. I would like to render my <meta>
tags before any <script>
tags (I'm trying to add these for getting indexed by search engines and it is much easier to read if they are on top of the source)
I thought this would help me (in my BasePage
)
public void renderHead(final IHeaderResponse response) {
response.render(MetaDataHeaderItem.forMetaTag(Model.of("description"), () -> "Cool generated description"));
super.renderHead(response);
The BasePage.html
relevant head section
...
<title wicket:id="pageTitle"></title>
<wicket:header-items />
...
The tags are render in the position of the <wicket:header-items />
, but still I end up with all the child javascript headers above my <meta>
tag.
What is the wicket-way of achieving this?
Wrap it in a PriorityHeaderItem
:
response.render(new PriorityHeaderItem(MetaDataHeaderItem.forMetaTag(Model.of("description"), () ->...)));