我可以向使用模板的特定页面添加元标记吗? [英] Can I add a meta tag to a particular page that is using templates
本文介绍了我可以向使用模板的特定页面添加元标记吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用模板的页面
I have a page that uses a template
<ui:composition template="/WEB-INF/facelets/templates/clientPage.xhtml">
我希望仅使用meta标签
I was hoping to only render the compatibility view for this particular page using the meta tag
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
该标签不起作用,除非将其添加到根模板页面中.有没有一种方法可以将其添加到使用该模板的特定页面.
The tag does not work unless I add it to the root template page. Is there a way I can add it to specific pages that use the template.
推荐答案
在主模板中的所需位置声明一个<ui:insert>
:
Declare an <ui:insert>
in the master template at the desired location:
clientPage.xhtml
<!DOCTYPE html>
<html ...>
...
<h:head>
<ui:insert name="head-meta" />
...
</h:head>
...
</html>
用另一个主模板扩展主模板:
Extend the master template with another master template:
i18ClientPage.xhtml
<ui:composition template="/WEB-INF/facelets/templates/ie8ClientPage.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<ui:define name="head-meta">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
</ui:define>
</ui:composition>
最后,让那些模板客户端使用此主模板.
Finally let those template clients use this master template instead.
这篇关于我可以向使用模板的特定页面添加元标记吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文