Keyword

K2 Article Titles In Facebook

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Senior Member
More
8 months 6 days ago #171187 by Red Evolution
Red Evolution created the topic: K2 Article Titles In Facebook
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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
8 months 6 days ago - 8 months 6 days ago #171203 by Fotis
Fotis replied the 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member
Last edit: 8 months 6 days ago by Fotis.

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Senior Member
More
8 months 5 days ago #171215 by Red Evolution
Red Evolution replied the 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
8 months 5 days ago #171222 by Fotis
Fotis replied the topic: K2 Article Titles In Facebook
You're welcome :)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

Moderators: william white

Powered by Kunena Forum