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.

Variable/Tag for Article Excerpt

April 20, 2012 11:10pm

Subscribe [3]
  • #1 / Apr 20, 2012 11:10pm

    Yazmin

    4 posts

    For some reason, when someone posts a link from our site to Facebook, the url gets set as the name of the article and the description defaults to our default description for the site, so I’m adding open graph meta tags.

    I saw I could use embed:title} and {site_name}, but now I need a variable to pull an excerpt of the article itself. Is there such a variable/tag?

    Also, I see the main EE doesn’t look like it’s using OGM tags and FB links their site just fine. I’m curious if anyone can shed some light on why it works fine on the main EE site without the tags?

    Thanks!

  • #2 / Apr 22, 2012 1:42pm

    Rob Allen

    3114 posts

    Are you using an addon to create FB links or your own code?

    Anyhow, can you post your FB link code here?

  • #3 / Apr 22, 2012 5:50pm

    Shane Eckert

    7174 posts

    Hey Yazmin,

    I second Rob’s questions. 😊

    Can we see an example? Any Add-On at play here?

    Please let us know!

    Cheers,

  • #4 / Apr 24, 2012 10:54am

    Yazmin

    4 posts

    Currently, we’re creating our own links. A simple copy/paste of the URL. So we don’t have FB link code.

    I’ve attached a FB capture that shows how FB is reading our link.

  • #5 / Apr 24, 2012 3:23pm

    Yazmin

    4 posts

    We did some additional digging around and noticed our doctype was set as:

    <!doctype html public "✰">

    Once we changed it to:

    <!doctype html>

    It fixed the issue and allowed FB to pull our information from our meta tags correctly.

    However, I’d still like to improve on the description FB is using to pull our information. So back to the original question, is there a tag we can use to get an excerpt of the article?

    Thanks!

     

  • #6 / Apr 25, 2012 3:52pm

    Shane Eckert

    7174 posts

    Hello Yazmin,

    I am not sure there is a tag you can use to pull a summary.

    I am going to move this over to the Community Help Forum. The community there may have some ideas.

    Cheers,

  • #7 / Apr 25, 2012 5:53pm

    aelvan

    33 posts

    Since it’s up to you to define the fields you want for your articles (channel), I don’t think there’s a notion in EE of what an excerpt is. That’s up to you to define.

    What I normally do is use a part of the article text as meta description. Depending on how you’re template structure is set up, you probably end up embedding an excerpt as a variable to you document header template, or, preferably, use Stash to insert it.

    In my article template, inside my channel entries tag pair, I usually have something like this:

    {exp:stash:set name="meta_description"}{exp:ce_str:ing remove_html truncate="180"}{article_text}{/exp:ce_str:ing}{/exp:stash:set}

    And then, in my document header template, I have:

    <meta property="og:description" content="{exp:stash:get name='meta_description'}"/>

    The CE String addon is used above to remove html and truncate the text to a maximum number of letters, but if you for instance create a separate, non-formattet text field in you channel field group for meta description, you don’t need to do this..

     

  • #8 / Apr 25, 2012 5:56pm

    aelvan

    33 posts

    Also, I see the main EE doesn’t look like it’s using OGM tags and FB links their site just fine. I’m curious if anyone can shed some light on why it works fine on the main EE site without the tags?

    And yeah, if there’s no open graph meta description tag, facebook uses the normal meta description tag, which expressionengine.com has.

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

ExpressionEngine News!

#eecms, #events, #releases