How to customize h:head when using ui:composition template?

霸气de小男生 提交于 2019-11-28 09:12:16
BalusC

The <h:outputStylesheet> is always automatically relocated to <h:head>, so you don't need to worry about this. For <h:outputScript>, which is by default rendered at the same line as where it's been declared, you can just set the target attribute to head, this way it will automatically be relocated to the <h:head> as well.

<ui:define name="center">
    <h:outputStylesheet name="css/style.css" />
    <h:outputScript name="js/script.js" target="head" />
    ...
</ui:define>

For other HTML head meta information, whenever necessary for some reason, you could just declare another <ui:insert>.

<h:head>
    <ui:insert name="htmlhead" />
</h:head>

which you can use as follows

<ui:define name="htmlhead">
    <meta ... />
</ui:define>

See also:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!