logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$40
I need help making facebook (og) read the correct canonical url

At the bottom of all pages on zinnedproject.org is an addthis box that allows sharing via facebook.

When you share home, or a page, with FB og does the right thing and extracts the title, thumbnail, description, etc:
http://zinnedproject.org/about

However, when you try to share any single post such as http://zinnedproject.org/posts/18569 then FB reads the canonical url as /posts, which throws a 404.

You can cut to the chase and try using this validator to test things out:
https://developers.facebook.com/tools/debug

The only differences between the og meta data on pages vs posts is that pages are og:type=website and posts are og:type=article... I was hoping that might make the url problem go away.. You can see the difference in the header of each...

So what would solve this?
I'll consider this solved when you can share the above /posts/18569 and FB extracts the proper title, excerpt, and thumb. Thanks!

Access to a staging server is available.

PS - This site uses a very odd permalink structure with some whacky rewrites in place. I inherited it and hope to remake it asap.

Jason

This question has been answered.

Jason Lemieux | 07/13/12 at 3:34pm Edit

Previous versions of this question: 07/19/12 at 12:03pm

(8) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    07/13/12
    3:43pm
    Michael Caputo says:

    I've not seen a <head> tag that looks like that...

    Maybe try just making it say <head>, and if possible place the meta tags right after the <title> tag.

    Previous versions of this answer: 07/13/12 at 3:42pm | 07/13/12 at 3:43pm

    • 07/13/12 3:47pm

      Jason Lemieux says:

      Mmmm i've already tried that :(

    • 07/13/12 3:50pm

      Michael Caputo says:

      I've copied the code from this page to an html file on my own server, and the debugger gives it an OK. https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fdiaryofarockstar.com%2Ftest.html - My guess is it has something to do with your Htaccess file, or permalinks.

    • 07/13/12 10:04pm

      Jason Lemieux says:

      Thanks, Michael.

      I'm trying to make sense of your results. Did you take test.html down already? The debugger says the page threw a 404, yet it manages to still display some of the og data. Maybe from a cached version of some kind? I'm quite confused.

      If it does turn out to be an htaccess problem do you have the chops to figure it out? I'm not in a position to really modify the permalink structure at this point in the life of the site.

      The part that drives me nuts is this: ok, /posts is a 404, yet /posts/xxxx is an actual article. I agree that is a pretty messed up way to make a site but it wasn't me and it's what we have to work with. That said.... why isn't og happy to just work with the urls we send it instead of trying to get all canonical on things? There's got to be some way to make it happen.

      Attached Image

  • avatar
    Last edited:
    07/13/12
    3:50pm
    sabby says:

    Hey dude,

    Can you change the permalink.

    • 07/13/12 9:52pm

      Jason Lemieux says:

      No, changing the permalinks at this time isn't possible. There are thousands of posts on the site and tons of cross linking all over the place. We are rebuilding it soon so the effort to change the permalinks and put in all of the redirects doesn't seem worth it...

    • 07/14/12 12:28am

      sabby says:

      Hey Dude,
      Just change the permalink and if it is working fine then we could fine other solution for this.

      Once we know that the issue is of permalink then we will get another solution.

      I was having same kind of problem with another client and I just change the permalink then we are done. ( we were using some other fb integration more than a year ago so can't remember this )

      Any way dear Just check and test. Do let us know know about this.

    • 07/14/12 9:27am

      Jason Lemieux says:

      Hey Sabby,

      I'm going to take Martin up on his offer of fixing it without tinkering w/ the permalinks and see where we get with that first. I like your idea though...

    • 07/14/12 1:49pm

      sabby says:

      Hi,
      If no one can do this work then mail me your detail on my gmail ( sabirsoftware@gmail.com ), If I see your code then I could able to solve this.

    • 07/19/12 12:14pm

      sabby says:

      Hi,

      at the end of each article I found this code :#.UAgxNuFF8wI

      What it is ?

      If you click here :
      https://www.facebook.com/sharer/sharer.php?u=http://zinnedproject.org/posts/16168

      So basically when u click on any single post there is attached code at the end which is creating problem

      for eg :

      http://zinnedproject.org/posts/13826#.UAgxNuFF8wI

      When u share this article it send this as

      https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fzinnedproject.org%2Fposts%2F13826%23.UAgx-_LbtKo.facebook

      if you remove %23 to end it will show the exact code what you want.

      So you need to find where is #.Ua coming from.

  • avatar
    Last edited:
    07/13/12
    6:17pm
    webGP says:

    Hello!

    Open AddThis settings page, switch tab to Advanced, uncheck the "Track clickbacks" option and save changes, it should help.

    • 07/13/12 9:52pm

      Jason Lemieux says:

      Thanks for the idea. I did give it a try but not dice :(

    • 07/19/12 12:54pm

      Jason Lemieux says:

      Hey Grzegorz,

      It turns out the problem was that addthis was still throwing a tracking code in the url because of a parameter in the script tag data_track_addressbar":true.

      The tracking code wasn't showing up for me because of the CDN somehow stripping it out. I have no idea how/why.

      I'm going to split the bounty between you and Martin. You for your idea, he for his time.

      Thanks everyone!

  • avatar
    Last edited:
    07/13/12
    11:10pm
    Manoj Raj says:

    Not sure whether it will work... Its a bit confusing to me...

    Try to disable redirect canonical


    remove_filter('template_redirect', 'redirect_canonical');

    • 07/14/12 10:17pm

      Manoj Raj says:

      Why don't you paste the htaccess code here? We can have a better idea...

  • avatar
    Last edited:
    07/14/12
    5:19am
    Martin Pham says:

    I checked this issue in the demo http://s.marxcdn.com/wordpress/posts/1

    I think this issue belongs Permalink structure and htaccess. I can handle this problem for you, Permalink will not change. I need access to some files of your theme, contact me if you agree with this (email: marxvn@gmail.com )

    • 07/14/12 9:28am

      Jason Lemieux says:

      Hey Martin,

      Ok, sounds like a plan. Let's start here. I'll PM you access.

    • 07/19/12 11:46am

      Jason Lemieux says:

      Hey Martin,

      Your solution was very close but there are a few things to tie up. Are you still around?

  • avatar
    Last edited:
    07/15/12
    8:02pm

    This answer was downvoted by the top experts.

  • avatar
    Last edited:
    07/15/12
    8:08pm

    This answer was downvoted by the top experts.

  • avatar
    Last edited:
    07/16/12
    9:05am
    Clifford P says:

    Just re save permalinks settings and see if that helps. Also, disable plugins or switch theme to Twenty Eleven and see if it's still giving errors.

    Previous versions of this answer: 07/16/12 at 9:05am

This question has expired.



Gabriel Reguly, Arnav Joy, Manoj Raj, Jason Lemieux voted on this question.



Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.