Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
IOS Hotels
and
IOS Rentals
online booking systems for Elxis CMS.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
How to add og meta tags to individual articles?
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to add og meta tags to individual articles? (Read 9604 times)
seadhna
Hero Member
Posts: 507
How to add og meta tags to individual articles?
«
on:
February 26, 2014, 11:20:17 »
Hi there,
wondering if it is possible to add open graph meta tags to individual articles (e.g. to control which image is shared on Facebook when the page is shared). Wordpress has a plugin for this I think but can't find anything in the Download Centre.
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: How to add og meta tags to individual articles?
«
Reply #1 on:
February 26, 2014, 13:24:04 »
It is very easy to add meta data in Elxis 4.x but to do this from the editor you need a plugin.
What kind of meta data you want to add. Can you write some HTML examples?
Adding custom meta tags in Elxis 4.x
eFactory::getDocument()->setMetaTag($name, $content);
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
webgift
Elxis Team
Hero Member
Posts: 4193
Re: How to add og meta tags to individual articles?
«
Reply #2 on:
February 26, 2014, 16:10:54 »
I suppose that the right place of Open Graph protocol is described here:
http://ogp.me/
Logged
Elxis Team •
Custom web design [EN]
-
[EL]
•
.GR Registrar
seadhna
Hero Member
Posts: 507
Re: How to add og meta tags to individual articles?
«
Reply #3 on:
April 08, 2014, 17:04:42 »
I would like to add this line to many articles on the site:
<meta property="og:{tagName}" content="{tagValue}"/>
but the tagName and tagValue must be different on each article. Is this possible?
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: How to add og meta tags to individual articles?
«
Reply #4 on:
April 08, 2014, 19:49:46 »
You need a special plugin to do this.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: How to add og meta tags to individual articles?
«
Reply #5 on:
April 16, 2014, 19:54:04 »
Thanks, what is the plugin?
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: How to add og meta tags to individual articles?
«
Reply #6 on:
April 16, 2014, 23:03:06 »
A plugin is an Elxis extension type which processes articles and performs various tasks.
For instance a plugin like the one I tell you could grab article's title and add the
og:title
meta tag in page headers automatically.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
michalis1984
Sr. Member
Posts: 334
Re: How to add og meta tags to individual articles?
«
Reply #7 on:
April 16, 2014, 23:22:43 »
If you install
facebook like plugin
it will add for you some og metatags at the articles where you add the plugin
for example from my site
<meta property="og:type" content="article"/>
<meta property="og:url" content="
http://www.site.com/article.html
"/>
<meta property="og:site_name" content="example"/>
<meta property="og:locale" content="el_GR"/>
<meta property="og:title" content="artcle title"/>
<meta property="og:image" content="article image"/>
If this suits your needs then you can try it.
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: How to add og meta tags to individual articles?
«
Reply #8 on:
April 17, 2014, 10:54:44 »
Ah, interesting, I have already built that!
There are so many the extensions I have built that I dont remember them all
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
michalis1984
Sr. Member
Posts: 334
Re: How to add og meta tags to individual articles?
«
Reply #9 on:
April 17, 2014, 12:27:27 »
There is an option at the content plugin parameters, thanks to Datahell.
The same option exist not only at facebook like content plugin but also at facebook comments content plugin.
So if you install one of these two and enable the option it will add for you these og metatags (together with like button or comments box) at the articles where you add them.
Logged
seadhna
Hero Member
Posts: 507
Re: How to add og meta tags to individual articles?
«
Reply #10 on:
April 21, 2014, 18:44:15 »
Hi again, thanks - this is great to learn about these plugins. I have the 'facebook like' plugin working but cannot get the 'facebook comment' plugin working. I get the error on the front-end (in Chrome):
href URL is not properly formatted
Doctype is HTML5:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />...etc...
However, in the source, the URL is using special characters which I think is causing the problem - any ideas why?:
http%3A%2F%2Fwww...etc...
Logged
michalis1984
Sr. Member
Posts: 334
Re: How to add og meta tags to individual articles?
«
Reply #11 on:
April 21, 2014, 19:06:44 »
I face in the past the same issue.
I realize that this i caused by urlencode($curl).
Urlencode
adds this % symbols at url replacing some characters and as a result facebook comments don't work.
What i did: i open the plugin, components/com_content/plugins/fcomments/fcomments.plugin.php
and at line 106 i replace .urlencode($curl). with .$curl.
and since then it works without any problem
Maybe this is not the appropriate way to solve this, as it says in the manual Urlencode is a convenient way to pass variables to the next page.
But in real life everyone who try to pass a url parameter to facebook comments using this, face the same issue so we must do something. This is not just for elxis!
Also i would like to note that although Urlencode is used and at "facebook like content plugin" it does not produce any error there. The problem is only at facebook comments mainly because facebook comments don't "understand" urls with %.
I think it is save to omit urlencode because as i can see at og its not used: <meta property="og:url" content="'.$curl.'"/>
But wait for datahell opinion.
«
Last Edit: April 21, 2014, 19:34:43 by michalis1984
»
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: How to add og meta tags to individual articles?
«
Reply #12 on:
April 21, 2014, 20:01:23 »
Facebook has the worst integration code ever. I don't use it, I don't recommend it, and I don't like it.
URL encode is the proper method to pass strings into URLs, especially if they contain non latin characters.
If this modification worked for you, I have nothing to say except to warn you that it might not work for people from other countries. It is a subject of the integration method.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: How to add og meta tags to individual articles?
«
Reply #13 on:
April 21, 2014, 21:17:48 »
Thanks for this michalis1984, this worked for me too. I agree with all your points datahell - it's an English language only site and must have FB integration though - making it responsive is another challenge...
Logged
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
How to add og meta tags to individual articles?