我正在使用Hippo CMS .
使用 HST SEO support plugin 失败后,我意识到HstResponse::addHeadElement
对我的 HTML 页面没有任何影响。
例如,在组件代码中添加以下行时:
Element title = response.createElement("title");
title.setTextContent("Foo");
response.addHeadElement(title, "hst.seo.document.title");
我期望相应的<title>Foo</title>
标记包含在响应中,但事实并非如此。
我错过了什么?
最佳答案
问题是我的布局文件中没有合适的 hst:headContributions
节点。
我有两个用于两个不同的类别:
<hst:headContributions xhtml="true" categoryIncludes="headerNav" />
和
<hst:headContributions xhtml="true" categoryIncludes="styles" />
但是该插件的头部贡献不使用任何类别。
在我的 JSP 模板中添加以下行解决了该问题:
<hst:headContributions xhtml="true" categoryExcludes="headerNav,styles" />
关于java - HstResponse::addHeadElement 没有效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22092620/