Keyword

[SOLVED] og:title putting in wrong code?

More
11 years 6 months ago - 11 years 6 months ago #112637 by Arien
Hi,

Whenever I share a link from an article from my site to facebook and there's an apostrophe in the the title, "'" appears (without the quotes) in place of the apostrophe. I'm not 100% certain why this is the case. I was looking at another site to see how the og:title tags differ and this is what I found:

My site:
'

Other site:
'

I think what I've determined is that the string for my site actually inserts the code for the ampersand instead of just placing the ampersand itself and that's what is breaking my apostrophe when sharing the links. I'm just not sure how to change the php to fix it.

I found the line of code for it in com_k2>views>item>views.html.php:

$document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8'));

Does anyone know how I can resolve this problem?

Oh and if it's relevant, I'm running Joomla! 2.5.8 and K2 2.6.6 with a RocketTheme template that uses Gantry 4.1.8.

Arien

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

More
11 years 6 months ago #112638 by Arien
Replied by Arien on topic Re: og:title putting in wrong code?
Anyone?

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

More
11 years 6 months ago #112639 by Arien
Replied by Arien on topic Re: og:title putting in wrong code?
I posted my question over at stackoverflow and got an answer almost immediately.

For those who run into this issue, change

$document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8'));

to

$document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_COMPAT, 'UTF-8'));

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

More
11 years 6 months ago #112640 by STEPHAN HERBY
Replied by STEPHAN HERBY on topic Re: og:title putting in wrong code?
Hi Arien,
Thanks a lot for your topic. I will try right now and keep you informed here about how it works for me :)

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

More
11 years 4 months ago #112641 by Mat Beard
Replied by Mat Beard on topic Re: [SOLVED] og:title putting in wrong code?
I've been struggling with this problem for a while (just one of a few). I've used the proposed solution, including setting double_decode flag to false and this has fixed most of the meta data problems.

However, I still have problems with the <meta name="title" /> which is still showing apostrophes as &amp;#039; -- so I must have missed something there?

Finally -- how come this doesn't affect everyone using K2? Why does it affect all my sites but some people have no issues? Is is a server configuration issue?

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

  • Frederic Egersdorfer
  • Frederic Egersdorfer's Avatar
  • Offline
  • New Member
More
5 years 5 months ago - 5 years 5 months ago #172241 by Frederic Egersdorfer
Replied by Frederic Egersdorfer on topic [SOLVED] og:title putting in wrong code?
I have been having this issue now as well, on my website, I use quotes and apostraphes. such as, "The Big Bang"
or 'The Big Bang' giving this code &#039;The Big Bang&#039;

I've just fixed the issue using the suggested method here.
Removing the code below.
$document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8'));

and changing it to

$document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_COMPAT, 'UTF-8'));

Now when I want to share items with the Quotes such as, "The Big Bang" I get, &quot;The Big Bang&quot;

This is very annoying. Please, can I ask that your team update the k2 again as I'm almost sure that the FB API is causing this issue?

I also replaced the share buttons with the AddThis code inside the view.php which is located inside the template of my theme as everyone is slow at removing Google+ button from their coding, I thought it best I replace it with the AddThis code and I was pleased to see that nothing broke. LoL!!!

I'm not an expert but understand what I am doing to a point, I am certainly not able to make head or tail out of this.

I am now also using PHP 7.2 - I hope this all makes sense?
Last edit: 5 years 5 months ago by Frederic Egersdorfer. Reason: incorrect wording in one sentence.

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

More
5 years 5 months ago #172250 by JoomlaWorks
Replied by JoomlaWorks on topic [SOLVED] og:title putting in wrong code?
I recommend you try v2.10 (dev) on top of 2.9.0 which addresses meta tags much, much better than previously. We also now have the canonical URL tag as well among other important changes. Version 2.10 final will be out in a matter of days.

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

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

  • Frederic Egersdorfer
  • Frederic Egersdorfer's Avatar
  • Offline
  • New Member
More
5 years 5 months ago - 5 years 5 months ago #172255 by Frederic Egersdorfer
Replied by Frederic Egersdorfer on topic [SOLVED] og:title putting in wrong code?
Hi,@Fotis.

Thanks for your reply...
I am actually already using the k2-master and this is throwing out these codes, & # 0 3 9 and & q u o t
while trying to use, quotes or apostrophes.
Last edit: 5 years 5 months ago by Frederic Egersdorfer.

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

More
5 years 5 months ago #172256 by JoomlaWorks
Replied by JoomlaWorks on topic [SOLVED] og:title putting in wrong code?
When did you install the GitHub version though? Changes are constant...

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