Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Technology / Plone SEO: Page Title Tag Customization
You are here: Home / Technology / Plone SEO: Page Title Tag Customization

Plone SEO: Page Title Tag Customization

| filed under: ,
A quick fix to decouple the document title from the site title

Plone SEO Page Title Tag Override
Plone SEO Page Title Tag Override

Plone generates the <TITLE> tag from the document title and appends the site title to it separated by an em dash, for example: Politics — My Mutterings.

The Plone SEO add-on provides the capability of customizing the HTML title tag.

Problem

Where the user decides to override the page title, Plone SEO replaces the title tag in its entirety. This results in a page title without Plone site title, for example: My Custom Title.

The only alternative would be to add the site title explicitly, which would then no longer be configurable via the Site Setup.

Fix

This is just a quick and dirty fix implemented via a Diazo rule:

Those who use a Diazo themed Plone site can add the following rule directive to the rules.xml file:

This will append the Plone site title with a url-encoded em dash to any page title tag which it is missing from.

<replace content="/html/head/title/text()"
         if-content="//title[not(contains(., //*[@id='portal-logo']/@title))]">
    <!-- append " &mdash; <site title>" -->
    <xsl:value-of select="concat(., ' — ', //*[@id='portal-logo']/@title)"/>
</replace>
Filed under: ,
Filed under: ,
Filed under: ,
Site designed by Crann Tara, powered by Plone & Python.