Show meta description only if set

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
oliver341
Forum Members
Forum Members
Posts: 89
Joined: Sat Feb 23, 2008 3:51 pm

Show meta description only if set

Post by oliver341 »

Hi, I've got this in my template:

Code: Select all

<meta name="description" content="{description}" />
However, I'd like to hide this line altogether if I haven't entered anything in the page's Description box. Is this possible with an if statement?
alby

Re: Show meta description only if set

Post by alby »

oliver341 wrote:

Code: Select all

<meta name="description" content="{description}" />
However, I'd like to hide this line altogether if I haven't entered anything in the page's Description box. Is this possible with an if statement?
Try this:

Code: Select all

{capture name="metadescription"}{description}{/capture}
{if $smarty.capture.metadescription ne ''}<meta name="description" content="{description}" />{/if}
Alby
oliver341
Forum Members
Forum Members
Posts: 89
Joined: Sat Feb 23, 2008 3:51 pm

Re: Show meta description only if set

Post by oliver341 »

Many thanks Alby, that works just fine.
Post Reply

Return to “CMSMS Core”