Jump to content

Best way to add individual Meta Descriptions to template header


Seiya

Recommended Posts

Hi,

 

My header.tpl is getting filled up with dozens of conditional statements to print the correct meta description for a specific page e.g.

 

{if $pagetitle eq 'Announcements'}
   <meta name="Description" content="News and announcements concerning our service."/>
{/if}

 

Is there a cleaner way to include these descriptions? Ideally I'd like them within the page templates but since the're in the <head> that doesn't seem possible. How have you done it?

Link to comment
Share on other sites

  • 5 years later...

I tried this in my header.tpl ... Then i tried

<meta name="description" content="{if $filename eq "web-hosting"}Reliable Web Hosting Service{/if}" />

It worked. But my question is that what to do for writing description for other pages? Writing the same code again? If it works, won't it harm my pagespeed?

Link to comment
Share on other sites

I tried this in my header.tpl and nothing happened ... Then i tried

<meta name="description" content="{if $filename eq "web-hosting"}Reliable Web Hosting Service{/if}" />

It worked. But my question is that what to do for writing description for other pages? Writing the same code again? If it works, won't it harm my pagespeed?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated