繁体   English   中英

Neos CMS:如何覆盖 <title>模板标题中的标签

[英]Neos CMS: How to overwrite <title> tag in head of template

如何覆盖默认模板开头的现有标题标签? 我可以添加一个新标签,但默认标题标签仍然存在。 我也想添加页面的描述。

default.html:

<head>
    <f:section name="meta">
        <title>{title}</title>
        <meta name="description" content="{description}">
    </f:section>
</head>

root.fusion:

page = Neos.Neos:Page {
    head {
        meta = Neos.Fusion:Template {
            templatePath = 'resource://Test.Package/Private/Templates/Page/Default.html'
            sectionName = 'meta'

            title = ${'Test | ' + q(node).property('title')}
            description = ${q(node).property('description')}
        }

我尝试根据Neos CMS文档上的示例进行操作: http : //neos.readthedocs.io/en/stable/CreatingASite/RenderingCustomMarkup/AdjustingOutput.html? highlight=meta#the-head

标题标签由Fusion模板headtitleTag设置。 要覆盖它,您必须执行以下操作:

page = Neos.Neos:Page {
    head {
        titleTag = Neos.Fusion:Tag {
            tagName = 'title'
            content = ${'Test | ' + q(node).property('title')}
        }

您也可以保留它在示例中的状态,但是必须将titleTag设置为null

page = Neos.Neos:Page {
    head {
        titleTag = null

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM