WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.11.x) »
  • Modules (Moderator: Boudi) »
  • SocialBaker OpenGraph canonical link not correct
  • Print
Pages: [1]   Go Down

Author Topic: SocialBaker OpenGraph canonical link not correct  (Read 15609 times)

Offline astricia

  • Posts: 783
  • Gender: Female
    • netSchmiede24
SocialBaker OpenGraph canonical link not correct
« on: November 20, 2018, 03:15:14 PM »
Hi all (esp. Ruud...),

I have SocialBaker (2.9) installed on a website und have the opengraph snippet included in my template.

It seems to work right - BUT I have a blog on that website, built with an OFA module. And when I want to post one of those blog items on Facebook, I did not get the expected headline and image - so I investigated a bit further.

The canonical link (first line of the opengraph output) contains TWICE the page title of my blog (aktuell). so it is:
Code: [Select]
<link rel="canonical" href="https://www.domain.tld/pages/aktuell/aktuell/title.php" />instead of
Code: [Select]
<link rel="canonical" href="https://www.domain.tld/pages/aktuell/title.php" />
Furthermore I put the URL into the Facebook Debugger (https://developers.facebook.com/tools/debug/sharing/), and it said that the following things are missing:#og:url, og:type, og:title, og:image, og:description, fb:app_id

I DO have og:url - but it is the same as the canonical link. I also have title and image - but Facebook is not picking it up. Maybe because of the wrong link in the canonical url ?

Help anyone?

Thanks,
Astrid
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: SocialBaker OpenGraph canonical link not correct
« Reply #1 on: November 20, 2018, 05:09:58 PM »
I just released version 2.10.
https://dev4me.com/modules-snippets/opensource/socialbaker/

The double /pages/ofa-parent/ in the link (canonical and og:url) was a bug (only when not using shorturl) that is fixed in this version.
This new version has a few other bugfixes like special characters handling in page titles.
As extra it ouputs a rich snippet for Bakery product pages with item details and pricing info.

So, just try this version.

I was looking at your website (assuming that was where the problem was) and I noticed you call openGraph() twice.
The first time with the first parameter "true". Your website is not using shortUrl so you should not do that. Facebook will get very confused :-)
Just use the <?php echo openGraph(); ?> call.

You can also use a second parameter that will show the page title (and metadata description, and used language). For OFA/Bakery pages it will use the item-title instead of the parent page title.
When "1" is used, the title will be "Page title - Website title".
"2" will only show the page_title
"3" will show "Website title - Page title".

I would advise to use <?php echo openGraph(false, 1); ?> in your website.

Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline astricia

  • Posts: 783
  • Gender: Female
    • netSchmiede24
Re: SocialBaker OpenGraph canonical link not correct
« Reply #2 on: November 20, 2018, 05:33:04 PM »
I wasn't actually talking about my own website - but you are certainly right that I need to work on that as well. Just too many clients projects at the moment to take care of my own stuff...

I just updated SocialBaker on the website I am currently working on - and it does fix the canonical link problem, but Facebook is still not scraping the link correctly. So there must be a different issue with it. Can you please take a look? I am trying to scrape this link:

https://www.rechtsanwalt-roesrath.de/pages/aktuell/scheidungs-abc.php

Thanks,
Astrid
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: SocialBaker OpenGraph canonical link not correct
« Reply #3 on: November 20, 2018, 06:00:51 PM »
Ok.. going into error finding mode :-)

If you look at the "See exactly what our scraper sees for your URL" link in the facebook debugger you will see that there are some wrong tags in the <head> of your template.This causes the facebook scraper not correctly seeing the <head> dection of that website.

This is the start of the debugger output:(note the <body? and <p> tags where you should not see them.
Code: [Select]
<!DOCTYPE html>
<html><body>
<p>&#65279;
<!--[if lt IE 7 ]><html class="ie ie6" lang="de"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="de"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="de"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><!--<![endif]-->

</p>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta charset="utf-8">

Looking with the firefox devtools at the result of the html call you see a (non printable) character before the <!DOCTYPE...
Probably this is because your template is saved in "UTF-8 with BOM".
If you use Notepad++ to edit your template you can convert this using the "Encoding" menu to UTF-8 (without BOM).

I cannot be sure just looking from here... but I think that might fix it :-)
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline astricia

  • Posts: 783
  • Gender: Female
    • netSchmiede24
Re: SocialBaker OpenGraph canonical link not correct
« Reply #4 on: November 20, 2018, 06:28:54 PM »
Perfect, Ruud - thank you. What would I do without all of you here in the forum? :-D
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.11.x) »
  • Modules (Moderator: Boudi) »
  • SocialBaker OpenGraph canonical link not correct
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2