Page 1 of 1

[solved] Title Tag for SEO

Posted: Mon Dec 10, 2012 6:40 pm
by zimmo
I have tried the following that I found on the documentation

Code: Select all

{content block="custom_title" assign="custom_title" oneline=true label="Custom Title Text"}
 
{if $custom_title}
<title>{custom_title} - {sitename}</title>
{else}
<title>{title} - {sitename}</title>
{/if}
As I wish to have a different title tag for each product in my cms. When I add the above to the template, it falls over. Am I doing this wrong??? I have added the above block to the template, but I get an error then?

Re: Title Tag for SEO

Posted: Mon Dec 10, 2012 6:59 pm
by uniqu3
It falls over, translated probably means that you have recieved a error message, but didn't bother to mention it?

That error message told you something about unrecognized tag.
Which comes from {custom_title} that is trying to trigger a Smarty plugin name {custom_title}, which well doesn't exist.

When you assigned in content block assign="custom_title", you have assigned it to a variable, which means you should also call that as a variable {$custom_title}

Re: Title Tag for SEO

Posted: Mon Dec 10, 2012 7:33 pm
by zimmo
Sorry about that. The error is a smarty template error like you say. But the thing is I am unsure how I add this variable or even do this, I am still new to smarty and cmsms.

The documentation is not very clear then. Can you tell me how I get this to work, where do I add the smarty plug in?

Sorry just trying to get this to work. Appreciate the support.

Re: Title Tag for SEO

Posted: Mon Dec 10, 2012 7:37 pm
by uniqu3
But i answered already ;D replace {custom_title} with {$custom_title}, you have assigned a content block to a variable, then you should use it as variable.

Re: Title Tag for SEO

Posted: Mon Dec 10, 2012 7:39 pm
by zimmo
Ahhh sorry, that simple eh.. Thanks very much got that working how I want it. Impressed that it is on the Main Option page as well, so you can do it all in one place. Brilliant. Many thanks

Re: Title Tag for SEO

Posted: Tue Jan 29, 2013 9:11 pm
by Dr.CSS