ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Custom meta descriptions for sections of a site

October 31, 2011 1:25pm

Subscribe [4]
  • #1 / Oct 31, 2011 1:25pm

    Dave Adamson

    7 posts

    Hi all,

    Wondering if anyone has any clever ways of allowing different meta descriptions for each section of a site?

    I currently have 4 sections of a site (including the index/home page) that require unique meta descriptions. The challenge is that at the moment, all pages of the site call one include for the document head (which contains the meta data, CSS reference, JavaScript reference etc).

    One way I thought of doing it is to create 4 document head includes, with each one having a section appropriate meta description. But it seems a bit clumsy and wondered if there was a better way?

    Any ideas gratefully received!

    Thanks
    Dave 😊

  • #2 / Oct 31, 2011 2:20pm

    Rob Allen

    3114 posts

    There are several meta addons that can help, eg http://devot-ee.com/add-ons/lg-better-meta

    Personally I never include entries/categories specific meta in a *global* embed, rather adding it to the display template along with various conditionals etc to facilitate alternatives such as category titles, paginated pages, single entry page etc.

    There’s no right or wrong way to do this, having 4 header includes is ok if it fits!

  • #3 / Oct 31, 2011 3:02pm

    Dave Adamson

    7 posts

    Thanks for your help Rob!

    I’ll take a look at the add-ons you suggest.

    Cheers
    Dave

  • #4 / Nov 01, 2011 2:53pm

    lincolnpixel

    83 posts

    Hi Dave,
          before going via third-party add-ons why dont you try this first “SEO Meta Tags”

    http://ellislab.com/blog/entry/seo_meta_tags

    While if you need some more complex features you can then go for the add-ons.

  • #5 / Nov 01, 2011 3:40pm

    Dave Adamson

    7 posts

    Great - thanks! I’ll take a look.

    Cheers
    Dave

  • #6 / Nov 01, 2011 5:38pm

    John St-Amand

    865 posts

    All you’ll wind up having to do is pass the entry-specific meta data through to your embedded global html header template as variables in your embed tag.  So if you have an embed at the top of your template for the global html header, you could wrap it with an entries tag pair matching what you have below, and feed in entry-level data as variables in the embed. So as a basic example

    {exp:channel:entries channel="my_channel" limit="1" orderby="date" sort="desc" disable="pagination|member_data|categories" dynamic="no"}
    
    {embed="embeds/global-html-header" the_entry_seo_title="{entry_seo_title}" the_entry_seo_description="{entry_seo_description}" the_entry_seo_keywords="{entry_seo_keywords}"}
    {/exp:channel:entries}

    And then subsequently in your global-html-header template, you simply use {embed:the_entry_seo_title} within the template where you would like to place the title.  Likewise with description, keywords or whatever else you want to pass through to the header from the entry level.

    There are also add-ons that will allow you to do this easier, such as Jumper or Stash, permitting you to use a single entries variable pair (in the page body where is really belongs), declaring these values within but then parsing them OUTSIDE of the entries tag pair, such as in your header embed.

    Food for thought!  Hope it helps.

  • #7 / Nov 08, 2011 6:32am

    Dave Adamson

    7 posts

    That’s great – thanks for your help John!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases