I am trying to setup meta tags for my site specifically for Facebook sharing.

I have 4 different channels and I want to ideally use the same channel field for each of them so I can efficiently publish the "description" tag without complex {if} statements.

What is the best way to achieve this?

If I can't use the same channel field can I use something along the lines of {{channel_short_name}_summary}?

Any help appreciated.


{exp:channel:entries channel="projects|case_studies|articles|about" url_title="{segment_3}" status="open" disable="categories|category-fields|member-data|pagination"}
{exp:channel_images:images entry_id="{entry_id}" cover_only="yes"}

<meta property="og:title" content="{title}"/>
<meta property="og:image" content="{image:url:small}"/>
<meta property="og:site_name" content="mysite.com"/>
<meta property="og:description" content="{{channel_short_name}_summary}"/>

5 Answers 5


I try to always prefix custom fields with the channel name like so:

  • projects_fieldname
  • case_studies_fieldname
  • articles_fieldname
  • about_fieldname

Swap out "fieldname" for the actual custom field name of course.

Aside: I often start with the channel, then custom field type, then name. For example about_textarea_summary. There is a character limit so sometimes you have to be smart about abbreviation.

Then if you want to go the variable variable route you could make use of the channel short name variable like you described.

<meta property="og:description" content="{{channel_short_name}_summary}"/>

In your case you'd of course have 4 different custom fields named like:

  • projects_summary
  • case_studies_summary
  • articles_summary
  • about_summary

This method of course is going to run up against Parse Order as those variables are parsed during stage 5 as is the channel entries tags and there is no way of knowing which will come first.

This is why using something like Stash nowadays is so great. You can also use segment variables because those are parsed earlier.

For example if you used the same naming conventions for your channel custom fields as I described above and you have your channel short names set as the first segment of the url you could do the following:

<meta property="og:description" content="{{segment_1}_summary}"/>

One thing to note is in the case of your case_studies channel you might want to go with case-studies_summary for the custom field name if your URLs use dashes over underscores.


If all you need is one field per channel, you could possibly use the oft-overlooked Channel Description field.

  • Good call. Often overlooked or just plain forgotten about but useful in that type of scenario.
    – Ian Young
    Commented Apr 27, 2013 at 9:46
  • Sadly it seems you can only access the channel description as a variable through the rarely-if-ever-used Channel Information Tag.
    – kmgdev
    Commented Jul 24, 2013 at 23:12

Ok I am not expert but basically I do this sort of thing like this...basically a router embeds a model which embeds a view (layout). You don't necessarily need the router bit...but the model and view approach is really really great and avoids all sorts of parse order conundrums.


I have a single router template as my index.html in each template group. This dissects the URL and then stash:embeds a model. Occasionally, above this, I have some stash sets to pull, for example, lists of categories I may use in the routing below. E.g.:


!-- Get the textures and the brands--}
{exp:stash:set parse_tags="yes" trim="yes" debug="yes"}
    {stash:textures}{exp:gwcode_categories cat_id="9" depth="3" style="linear" backspace="1"}{cat_url_title}|{/exp:gwcode_categories}{/stash:textures}
    {stash:brands}{exp:gwcode_categories cat_id="10" depth="3" style="linear" backspace="1"}{cat_url_title}|{/exp:gwcode_categories}{/stash:brands}
{!-- Join those together --}
{exp:stash:set parse_tags="yes" trim="yes" debug="yes"}

And then (just part of it)

(below the top, the actual url routing)

{exp:stash:parse parse_vars="yes" parse_depth="3"}
    {exp:switchee variable="{segment_2}" parse="inward" debug="yes"} 
        {!-- PAPERS MAIN INDEX --}
        {case value=""}

    {!-- PAPERS --}
    {case value="paper"}
        {switchee variable="{segment_3}" parse="inward" debug="yes"}
            {case value=""}
            {case value="{stash:sub_cats}"}
            {!-- PAPER ENTRY --}
            {case default="yes"}
    {/case}   {!-- seg2 = "paper" --}


This model is basically a channel entries wrapped around a bunch of stash:sets. Indeed, it may also pull categories data or whatever. The beauty of it is you just pull all the data as stash set it as variable, you don't need to worry about parse or page order at all really.



{exp:channel:entries channel="product_inkjet_paper" disable="{lv_disable_default}" limit="1" url_title="{segment_3}" require_entry="yes" dynamic="no"}

{exp:stash:set name='page_title'}{title}{/exp:stash:set}
{exp:stash:set name='page_h1'}{title}{/exp:stash:set}

{exp:stash:set debug="yes"}

{!-- CATEGORY FIELDS --} {exp:gwcode_categories entry_id="{entry_id}" excl_cat_id="10" excl_cat_id_children="yes" last_only="yes" style="linear" parse="inward"} {exp:stash:set debug="yes"}
{stash:cat_url_title}{cat_url_title}{/stash:cat_url_title} {stash:cat_name}{cat_name}{/stash:cat_name} {stash:cat_id}{cat_id}{/stash:cat_id} {stash:cat_title}{cat_title}{/stash:cat_title} {/exp:stash:set} {/exp:gwcode_categories}

{sc_set_basic_entry_fields} - this is an early parsed low variable that just contains basic stash:sets of entry_id, channel_short_name etc.

The model embeds the layout, which is where we put this all together. I break mine up into modular little chunks, each stored as an early parse low variable (a snippet)





{exp:stash:parse parse_tags="yes"}




<div id="page_footer">


(Not this is not a fully finished example and I have cut various things for brevity).

Each sc_whatever is something very simple, and a self contained block, like:

{exp:ce_img:pair src="{stash:master_image_url}" max="175" crop="no" allow_scale_larger="no" parse="inward"} {/exp:ce_img:pair}

So, and finally here's the point - the only thing that varies really, for each of your channels, is the model. It pulls from the different channels using their fieldnames, whatever they are, but it stashes the data into the same named stash variables - so that you only need one layout template to deal with the data coming from different channels. (You can take it a step further and do template inheritance as well - https://github.com/croxton/Stash/wiki/Template-inheritance - although I haven't implemented that yet myself).

You can see an alternate and better described version of this at http://pixelfear.com/blog/stash-workflow

Hope this helps! Obviously this is a non-trivial amount of complexity to solve this particular issue...but I am using it for a lot more than this of course. And conce you're on top of it - separating data retrieval from display in EE - I think it would be hard to go back to another approach as this so deftly avoids a whole host of issues and brings performance gains to boot...


Unfortunately you pretty much need to have the "same" field for each channel.

Prefixing the field names with channel short name is clever, or you could just output all of the variables in your loop. Nasty, but gets the job done, as any field name you call that doesn't exist, is simply ignored.

<meta property="og:description" content="{projects_summary}{case_studies_summary}{articles_summary}{about_summary}"/>

+1 for Stash for this (and almost everything!).

You can pull from all the channels usign whatever filed names you have used, and stash the data into stash variables the same names, and then inject these into re-usable template chunks. It's great!

Not only does it solve this annoying issue with fieldnames, it neatly gets around a whole host of parse order crap at the same time. Once you get it, it makes development a LOT more DRY and indeed simply easier.

  • I tried using regular {exp:stash:set} and {exp:stash:get} tags, but the resulting custom field tag was output as text rather than parsed.
    – kmgdev
    Commented Jul 25, 2013 at 15:08
  • Well, did you use parse_tags="yes"?. Also - are you doing the setting and getting at different stages? I basically use a model to set all the data and this model stash embeds a layout template which in turn pulls the data. E.g. setter {stash:embed:layouts:layout_product_printer} ....channel entries Commented Jul 25, 2013 at 23:33
  • oh this stupid editor. will do answer. Commented Jul 25, 2013 at 23:38
  • I put my specific situation in a separate question if you want to answer over there: expressionengine.stackexchange.com/q/12261/5
    – kmgdev
    Commented Jul 25, 2013 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.