CMS MADE SIMPLE FORGE

SEOTools2

 

[#8408] The variable $metadescription in detail pages does not replace the metadescription content block

avatar
Created By: Chris (caciavar)
Date Submitted: Mon Sep 17 11:27:36 -0400 2012

Assigned To:
Version: 1.1
CMSMS Version: 1.11.1
Severity: None
Resolution: Invalid
State: Open
Summary:
The variable $metadescription in detail pages does not replace the metadescription content block
Detailed Description:
With this in the page template...

{if !isset($metadescription)}{content block='metadescription' label='Page
description for SEO' oneline='true'}{/if}

...And this in the detail template...

{assign var=metadescription value=$entry->fields.metadescription->value}

...The $metadescription from the detail template is never used. The "page
description" from the parent page always supersedes the detail description in
the detail template. Even if the page description is blank and the detail
description is set, the blank page description will appear in the meta
description tag.


History

Comments
avatar
Date: 2012-09-17 21:14
Posted By: Prue Rowland (psy)

Marking it invalid is a bit harsh but there was no other choice.  It's not
necessarily an SEOTools2 thing, it's Smarty.

In the <head> section of your template, replace the {SEOTools2} tag with:

{capture assign='seo2'}{SEOTools2}{/capture}
{if strpos($seo2,$metadescription) !== false}
{$seo2}
{else}
{assign var=newtag value="<meta name='description'
content='"|cat:$metadescription|cat:"'>"}
{assign var='start' value=$seo2|strpos:"<meta name='description'"}
{assign var='endoftag' value=$seo2|strpos:">":$start}
{assign var='length' value=$endoftag-$start+1}
{$seo2|substr_replace:$newtag:$start:$length}
{/if}

What it does is first check to see if the $metadescription is the same as
SEOTools2 spits out.  If so, no problem.

Otherwise it replaces the old <meta name='description'...> tag with one that
includes the smarty assigned content.

Hope this helps.
psy

      
avatar
Date: 2012-09-23 06:01
Posted By: Prue Rowland (psy)

I will try to make this to happen automatically in the next release but no
promises.

psy

      
Updates

Updated: 2012-09-17 21:14
resolution_id: => 9