fusionneoscms

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


How can I overwrite the existing title tag in the head part of my default template? I can add a new tag but the default title tag is still there. Also I would like to add the description of the page.

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')}
        }

I tried to make it according the example on the Neos CMS documentation: http://neos.readthedocs.io/en/stable/CreatingASite/RenderingCustomMarkup/AdjustingOutput.html?highlight=meta#the-head


Solution

  • The title tag is set by titleTag in head section of Fusion template. To overwrite it you have to do it as follows:

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

    You can also leave it as you have in your sample, but you have to set titleTag to null:

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