0

I want to dynamically add content to the facebook open graph meta data. Here's my code, but the content field shows up blank on page load.

<meta property="og:title" content="{exp:channel:entries}{title}{/exp:channel:entries}">

I tried the other solutions and SEO Lite has very bad documentation so I'm not sure what to do.

1 Answer 1

1

Well, first of all, your {exp:channel:entries} tag has zero parameters, meaning you have little control over what's being loaded unless it is detecting it from the URL. I'm also guessing it's possible this Channel Entries loop lives inside of another one, which won't work. You'll have to provide significantly more information for us to give you a real answer...

But without more details, I'm going to guess you have a nested Channel Entries loop. Use an embed if you need to pull a different channel entry title in, or just use the {title} tag if it's already in a loop.

If it isn't nested and you're not sure what's going on, try hard coding an entry_id and test a few parameters to see if you get an output. Try these parameters on the tag:

{exp:channel:entries entry_id='1' dynamic='no' limit='1'}{title}{/exp:channel:entries}

Use a known entry_id that has a status of open. See if that gets you somewhere.

4
  • Tried adding in that tag with no result. I'm running expression engine 2 and there's not much of documentation on how to use channel:entries lest you already know what you are doing (spoiler alert: I don't).
    – Edward
    Apr 1, 2016 at 18:40
  • Also, it's worth mentioning I'm testing this on localhost and using inspect element to see the output of the og:title content.
    – Edward
    Apr 1, 2016 at 18:51
  • 1
    Do you have any channels created? Are you able to output channel entry data elsewhere?
    – jrothafer
    Apr 1, 2016 at 19:15
  • And if you do have a channel created, make sure it is assigned a Status Group. If you don't the channel entries act a little funky because they don't have any standard status.
    – jrothafer
    Apr 2, 2016 at 6:40

Your Answer

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

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