• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: SEOTools2 with detail pages
PostPosted: Fri Jun 15, 2012 10:57 am 
Offline
Power Poster
Power Poster

Joined: Sat Jan 22, 2005 11:19 am
Posts: 463
SEOTools2 is designed to output keywords and meta descriptions for entire pages. That doesn't quite work when you have a detail page, eg News, CGBlog, Products etc.

You can replace the standard page meta by following a few simple steps.

For each of the modules that have detail pages, create two custom fields. Call them what you will so long as they are the same across all the modules, eg 'detail_keywords' and 'metadescription'.

At the end of your detail template, put:
\$1:
{assign var=metadescription value=$entry->fields.metadescription->value}
{assign var=detail_keywords value=$entry->fields.detail_keywords->value


Or whatever the semantics are for retrieving the custom field value for the module.

This makes those vars available to the entire page, not just the individual modules.

Next, at the bottom of your page template, enter:
\$1:
{if !isset($metadescription)}{content block='metadescription' label='Page description for SEO' oneline='true'}{/if}


This will retain the detail page's metadescription rather than replacing it with the page's metadescription. The var name must match the name of the content_block you've nominated as the content block for the meta description in SEOTools2.

Next, in SEOTools2, wherever you have the {keywords} tag, say:
\$1:
{if isset($detail_keywords)}{$detail_keywords}{else}{keywords}{/if}


In other words, replace the page keywords with the detail page keywords.

Although they only appear as single line fields, the SEOTools2 page title and meta title fields have full Smarty template processing capabilities.

Of course this will only work when the config process_whole_template is set to false. The body html must be processed before the head stuff.

Have fun with this,
psy


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: SEOTools2 with detail pages
PostPosted: Tue Sep 18, 2012 1:39 am 
Offline
Power Poster
Power Poster

Joined: Sat Jan 22, 2005 11:19 am
Posts: 463
Another way to use your assigned var {$metadescription} which definitely works with CMSMS 1.11+:

Make all the modifications as above in the detail and page templates with the following change to the {SEOTools2} tag in the <head> section:

\$1:
{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 firstly check to see if the {$metadescription} tag is the same as what SEOTools2 outputs. If so, no problem.

Otherwise it replaces the <meta name='description' content='whatever is assigned on the actual page' > with a new tag that includes the $metadescription assigned in the detail template.

PS: Remember to change |cat:"'>"} to |cat:"' />"} if you're using XHTML.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: SEOTools2 with detail pages
PostPosted: Wed Oct 31, 2012 5:46 pm 
Offline
Forum Members
Forum Members

Joined: Tue Apr 22, 2008 2:54 pm
Posts: 23
Location: Toronto
how about keywords?
the tag {keywords} is no longer there. Now we have {seo_keywords}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting