Keyword

K2 Article Titles In Facebook

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
5 years 2 months ago #171187 by Red Evolution
K2 Article Titles In Facebook was created by Red Evolution
Hi Fotis,

Our client afloat.ie had been using the dev version of K2 but had noticed that when they were sharing articles to Facebook, the punctuation was being displayed as html (www.dropbox.com/s/f3w0e4guvfbrlfz/Screenshot%202019-02-04%2007.49.53.png?dl=0). We downgraded K2 back to 2.8 and when they share articles now, the titles are displayed correctly. Any idea what could be causing this?

Thanks,
Dave

Please Log in or Create an account to join the conversation.

More
5 years 2 months ago - 5 years 2 months ago #171203 by JoomlaWorks
Replied by JoomlaWorks on topic K2 Article Titles In Facebook
Actually, the latest v2.9.1 (dev) builds have (for some time already) been using the actual item title for the social meta tags. But it looks like the problem is in the setMetaData() function in Joomla as it insists on converting twice content that is already filtered as HTML entities.

I have overridden Joomla's function here: demo.getk2.org/category-blog/story/232/aliquam-volutpat-erat-at-dui-ultricies-dignissim?upd=1 (check the meta tags for og:title etc.).

You can modify your item.php override and place this at the very top of the file:
$document = JFactory::getDocument();
$socialMetaTitle = str_replace(['&', '''], ['&', '\''], $this->item->title);
$document->setMetaData('og:title', $socialMetaTitle);

For the record, older K2 versions merely used the document title, but that's not correct as it may hold the site name as well.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 5 years 2 months ago by JoomlaWorks.

Please Log in or Create an account to join the conversation.

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
5 years 2 months ago #171215 by Red Evolution
Replied by Red Evolution on topic K2 Article Titles In Facebook
Thanks Fotis, I'll give that a go and let you know how it goes.

Dave

Please Log in or Create an account to join the conversation.

More
5 years 2 months ago #171222 by JoomlaWorks
Replied by JoomlaWorks on topic K2 Article Titles In Facebook
You're welcome :)

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum