Another metadescription tag question - sorry
Posted: Thu Nov 06, 2014 2:45 am
Hi,
I'm having an issue auto-generating my description tags.
In each page template I have:
{capture assign=metadescription}{content block="metadescription" label="META Description" oneline="true"}{/capture}
just before the </__html> tag.
In the metadata tag I have:
<meta name="description" content="{if isset($metadescription)}{$metadescription}{else}{$main_content|strip_tags|truncate:'200'|strip}{/if}"/>
The idea being, if the metadescription block is filled in, it displays that, if not, it grabs the first 200 words form the main_content block.
This seems to work on some of my sites, but not all?
Any suggestions?
Next, i'll try and get the og:image tag to auto generate..
Thanks for any help.
Cheers,
I'm having an issue auto-generating my description tags.
In each page template I have:
{capture assign=metadescription}{content block="metadescription" label="META Description" oneline="true"}{/capture}
just before the </__html> tag.
In the metadata tag I have:
<meta name="description" content="{if isset($metadescription)}{$metadescription}{else}{$main_content|strip_tags|truncate:'200'|strip}{/if}"/>
The idea being, if the metadescription block is filled in, it displays that, if not, it grabs the first 200 words form the main_content block.
This seems to work on some of my sites, but not all?
Any suggestions?
Next, i'll try and get the og:image tag to auto generate..
Thanks for any help.
Cheers,