We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Adding OG Tags to EE pages to enable images etc. on LinkedIn

How Do I?

RegIndex's avatar
RegIndex
2 posts
5 years ago
RegIndex's avatar RegIndex

I have an EE website (www.regulatoryindex.com) that produces news articles. Some of these I like to share on LinkedIn. BUT unfortunately when I do LinkedIn doesn’t grab the image, the name of the news article or the description.

This particular new article (https://www.regulatoryindex.com/news/article/covid19-are-we-being-experimented-on) I tried on LinkedIn Post Inspector and it asked me to Add an og:description tag to the page to have control over the content’s description on LinkedIn.

In relation to the Image it said to add <meta name=”image” property=”og:image” content=”[Image URL here]”> to the page’s head section and similar for the Description and Author.

Now here’s the problem (for me), I have super user access to the site (the previous developers no longer have their EE expert and now want to charge me £A Lot per hour) but I think I need some help.

I’m comfortable editing the relevant templates to add the correct OG meta tags code and I am aware of the correct template that contains the <head> information for each of my pages BUT, I am not sure how to enter the details in the template to make sure it pulls out the relevant details from the individual News pages (individual Entry) each time.

The META info I intend to add to the <head> section is shown below, but the bits in [square brackets] is where I need help PLEASE!!

<meta content=”[title of news item page]” property=”og:title” /> <meta content=”[background image of the specific page]” property=”og:image” /> <meta content=”[abbreviated article desecription]” property=”og:description” /> <meta content=”[the relevant URL for each page]” property=”og:url” />

I’ve attached a couple of images that may help, including the entry for the page in question and the code for the relevant template

Many thanks in advance

       
RegIndex's avatar
RegIndex
2 posts
5 years ago
RegIndex's avatar RegIndex

I should add that I am using EE V 2.11.7

       
Rob Allen's avatar
Rob Allen
2,950 posts
5 years ago
Rob Allen's avatar Rob Allen

It’d be a lot easier if you use “template layouts” which allow you to output values more easily.

However it’s still possible using your existing includes/header template - you seem to be calling an exp:channel:entries tag for, I presume, single entry pages, so you’d add your meta data fields in there.

First you need to add some custom fields for your meta data to whatever channels need them.

Second you need to call those fields in your header template, here’s a simplified example:

{exp:channel:entries...}
<title>{title} | Regulatory index</title>

<meta name="description" content="{your_meta_field}">

<meta name="og:description" content="{your_meta_field}">

{/exp:channel:entries}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.