在Apache tile定义文件中配置元标记?

问题描述 投票:0回答:1

如何在Apache切片定义文件中创建元标记?对于每个页面,我可以创建一个唯一的标题标签但是如何创建元标记?

我的标题定义创建如下。

    <put-attribute name="title" value="Random Books"></put-attribute>

如何创建下面显示的元标记?

    <meta name="keywords" content="Novels,Books" />

我似乎无法在网上找到任何创建元标记的示例。

我能够通过将其添加到jsp默认页面来实现此目的

<tiles:insertAttribute name="metaKeyword" ignore="true" /> 

在Apache tiles defintions文件中有以下内容

<put-attribute name="metaKeyword" expression="&lt;meta name=&quot;keywords&quot; content=&quot;Novels,Books&quot; /&gt;"></put-attribute>

当然有更好/更正确的方法来做到这一点?

java jsp spring-mvc apache-tiles
1个回答
0
投票

也许这样做是正确的方法吗?这个对我有用...

<put-attribute name="metaKeywords" value="Novels,Books"/>

<meta name="keywords" content="<tiles:insertAttribute name="metaKeywords" ignore="true"/>"/>
© www.soinside.com 2019 - 2024. All rights reserved.