Search

I'm wondering what the best way to make page titles work for entries is? I'm not talking about headers, but the actual title, in the head, in a <title> tag. I'm having problems because the head is in a "master" utility, (along with the body) and so the title can't be set by individual entries.

Check out this article by Allen. It explains how to deal with this exact situation as an example of a more general pattern you will find yourself using a lot with Symphony.

I usually use variables for stuff like this.

I define a generic page title in the master utility...

<xsl:variable name="title" select="concat(/data/params/page-title, ' - ', /data/params/website-name)"/>    
<xsl:template match="/">        
  <html lang="de">
    <head>
      <title><xsl:value-of select="$title"/></title>
      ...

and override it (where neccessary) with a more specific value in the page template...

<xsl:variable name="title" select="concat(/data/magazine-article/entry/titel, ' - Magazin - ', /data/params/website-name)"/>    
<xsl:template match="data">    
  ...

Sorry jensscherbl, didn't your comment 'til now...

Thanks both of you for the reply's, they are both quite helpful...

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details