- Posts: 3
COMMUNITY FORUM
Twitter Image - Meta data
- Deljo
- Topic Author
- Offline
- New Member
Less
More
7 years 1 month ago #164615
by Deljo
Twitter Image - Meta data was created by Deljo
Can anyone help me with twitter meta data? I got this code:
$document-> setMetaData ('twitter:image', 'http://mysite/logo-twitter.jpg');
But what i actually need is, to replace the url with $image from items in K2 Component.
I`ve try several codes, but they don`t work:
$document-> setMetaData ('twitter:image', '$image');
$document-> setMetaData ('twitter:image', '.$image.');
$document-> setMetaData ('twitter:image', '$images');
I eve try some of the plugins or components provide from Joomla.org, but no success :(
$document-> setMetaData ('twitter:image', 'http://mysite/logo-twitter.jpg');
But what i actually need is, to replace the url with $image from items in K2 Component.
I`ve try several codes, but they don`t work:
$document-> setMetaData ('twitter:image', '$image');
$document-> setMetaData ('twitter:image', '.$image.');
$document-> setMetaData ('twitter:image', '$images');
I eve try some of the plugins or components provide from Joomla.org, but no success :(
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 1 month ago #164626
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Twitter Image - Meta data
Where did you place this code in your overrides?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Deljo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
7 years 1 month ago #164680
by Deljo
Replied by Deljo on topic Twitter Image - Meta data
/components/com_k2/views/item/view.html.php This is the file that i modify
Everything is working fine, Twitter card is verified:
INFO: Page fetched successfully
INFO: 19 metatags were found
INFO: twitter:card = summary tag found
INFO: Card loaded successfully
But image is not loading from the article in K2, because of this line: $document-> setMetaData ('twitter:image', 'http://mysite/logo-twitter.jpg');
How to set that line to follow the image from article?
Everything is working fine, Twitter card is verified:
INFO: Page fetched successfully
INFO: 19 metatags were found
INFO: twitter:card = summary tag found
INFO: Card loaded successfully
But image is not loading from the article in K2, because of this line: $document-> setMetaData ('twitter:image', 'http://mysite/logo-twitter.jpg');
How to set that line to follow the image from article?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 1 month ago #164688
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Twitter Image - Meta data
This is a core hack and it will lead to losing your changes when you update.
Is there a link to your site?
Is there a link to your site?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Deljo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
7 years 1 month ago - 7 years 1 month ago #164707
by Deljo
Replied by Deljo on topic Twitter Image - Meta data
www.medium.edu.mk the K2 Component is here: www.medium.edu.mk/srednoskolski-medium/niz-hodnicite
It`s not a problem for the update, i`ll change the code every time, tnx for the advice :)
It`s not a problem for the update, i`ll change the code every time, tnx for the advice :)
Last edit: 7 years 1 month ago by Deljo.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 1 month ago #164723
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Twitter Image - Meta data
You can use Joomla!"s add customMetaTag in your item.php overrides.
api.joomla.org/cms-3/classes/JDocumentHtml.html#method_addCustomTag
Example:
You can see how the og tag for Facebook is being constructed:
github.com/getk2/k2/blob/master/components/com_k2/views/item/view.html.php#L588-L590
api.joomla.org/cms-3/classes/JDocumentHtml.html#method_addCustomTag
Example:
$doc = JFactory::getDocument();
$doc->addCustomTag("THE CUSTOM TAG HERE");
You can see how the og tag for Facebook is being constructed:
github.com/getk2/k2/blob/master/components/com_k2/views/item/view.html.php#L588-L590
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.