Where to add the meta property "og:url"?

Posted in: Newspaper
Post count: 90

When our site was moved from
http://vastavalkea.fi
to
https://vastavalkea.fi
all old Facebook Likes were lost.

The page
https://developers.facebook.com/docs/plugins/faqs#moving-urls
gives the following instruction:

********************************************

Add an og:url tag to the new URL which points at the old URL (Preferred)

In your new URL, you should include a link to the old URL. For example, if your new URL was https://example.com/new-url, and the old URL was https://example.com/old-url, you should include this snippit in the new-url:

<meta property=”og:url” content=”https://example.com/old-url&#8221; />

********************************************

Could you tell me precisely *where* I should add such snippets?

For example, the following article has lost all its old Facebook Likes:

https://vastavalkea.fi/2016/02/10/merkittavat-tapahtumat-saa-jattaa-uutisoimatta/

Would I need to modify the article and add

<meta property=”og:url” content=”http://vastavalkea.fi/2016/02/10/merkittavat-tapahtumat-saa-jattaa-uutisoimatta/&#8221; />

somewhere within that article? Or somewhere else?

Thank you for your help.

  • This topic was modified 9 years by Vesa.
Post count: 22421

Hello,

Unfortunately I cannot guarantee this method will actually work or not. Our theme does not handle the og image, but rather seo yoast does.
https://forum.tagdiv.com/facebook-share/
The guide you mention points to this link:
https://developers.facebook.com/docs/sharing/opengraph/using-objects
As it recoments you will have to place the snippet in the head section of the site, meaning here: http://screencast.com/t/iEW0qFY3oej
We did not test this so I cannot say for sure your likes will be back though.

Thank you!

Post count: 90

Hello Bogdan,

The problem is that all our blog posts before the move from http… to https… lost their original Likes (because of the changed URL).

What, therefore, should be the “content” in the “og:url” meta property in the header.php file, so that all changed URLs are affected collectively? Or is that possible in the first place? If it is, could you fill it in below?

<meta property=”og:url” content=”___________________” />

Thanks again,
Vesa

Post count: 9544

You should have the new canonical url as the og url moving forward, and have the old urls all 301 redirecting to the new version, meaning all old http urls shoukd automatically forward to https version.

If you use the old url as og url then all future likes shares would point at wrong location.

If you dont care about google or seo, and all you care about is tracking old likes, you could make a function to insert the permalink and rewrite the https to http. You likely would need to hire developer, as not related to the theme in any way.

Post count: 285

Hi guys,
Bogdan you can use some different social plugins that have this funcionality, e.g.: Mashshare.
On the back-end they have an option “Cumulate Http(s) Shares”.
If you not use Yoast, this plugin will add all Open Graph Meta Tags for you. The only thing, if you want to use all social networks … +/-19$, coze with the free version you will have only Facebook & Twitter., but worth any penny.

Regards.

  • This reply was modified 9 years by nairolf.
Post count: 285

Sorry I meant Vesa and not Bogdan 🙂

Post count: 90

Hi Chris,

At

https://developers.facebook.com/docs/plugins/faqs#moving-urls

it says that future Likes will work OK:

“Using this method tells the crawler that the canonical URL is at the old location, and it will use that to generate the number of likes and shares on the page. Any new likes and shares will continue to aggregate on the old URL as well.”

Post count: 90

Hi Bogdan,

Following your suggestion – would you have an idea about the following (copied from my follow-up question above)?

What, therefore, should be the “content” in the “og:url” meta property in the header.php file, so that all changed URLs are affected collectively? Or is that possible in the first place? If it is, could you fill it in below?

<meta property=”og:url” content=”___________________” />

Post count: 22421

Hello,

Well following facebook’s instructions you should add the old url like it says right here:
In your new URL, you should include a link to the old URL. For example, if your new URL was https://example.com/new-url, and the old URL was https://example.com/old-url, you should include this snippit in the new-url:

<meta property=”og:url” content=”https://example.com/old-url” />

But again. We have not tested this so we cannot guarantee it’s success. You should check into a few guides into how to move from http to https: https://forum.tagdiv.com/topic/moving-to-ssl/
https://codex.wordpress.org/Moving_WordPress
https://wordpress.org/support/topic/how-to-move-wp-site-to-another-domain/
http://www.wpbeginner.com/wp-tutorials/how-to-properly-move-wordpress-to-a-new-domain-without-losing-seo/

I hope this helps.
Thank you!

Post count: 90

Thanks for returning to this, Bogdan.

From the screencast you linked above, one would have to add the snippet to the head section of the site, meaning the header.php file.

But precisely how should one edit the header.php file so that all the hundreds of already published posts are affected?

I will have a look at the guides you kindly linked.

Vesa

Post count: 23312

Hello Vesa,

You should use a PHP editor, like Notepad Plus Plus or anything else and then you should edit the header.php file, like this -> http://screencast.com/t/7esHX3MX

Hope this helps!

Thanks for the message!

Post count: 90

Thanks Catalin!

So, the <head> section of the header.php file should be exactly like in the screencast. And that should solve the problem.

We’ll give it a try.

Post count: 90

Hello Catalin,

I noticed that the header.php file already was exactly as shown in the screencast.

Any more specific ideas of how to solve the problem of lost old Facebook Likes?

Post count: 23312

Hello Vesa,

Please keep in mind that the Likes are not loaded in our database and these are countered by your facebook account. Do you change the URL? If you changed it, the likes will begin from scratch.

Thanks for the message!

Viewing 14 posts - 1 through 14 (of 14 total)
The forum ‘Newspaper’ is closed to new topics and replies.