WordPress.org

Ready to get started?Download WordPress

Forums

WP Facebook Open Graph protocol
[resolved] Problem with trailing slash in home page url (4 posts)

  1. mazaisti
    Member
    Posted 2 years ago #

    We have a website where we use wpfbogp and we have had some problems with og:url -tag.

    Facebook debugger complains that "... property values for a given property being mismatched. Here are the input property =>content pairs that were not seen in the parsed result: 'og:url => [our site url WITH trailing slash]"

    At website the meta og:url tag is WITHOUT the trailing slash on home page.

    The problem is that Facebook always adds the trailing slash in to url and WordPress always strips it off when stored in the general settings and that causes mismatch in Facebook url comparison.

    I solved the problem by modifying wpfbogp code like this (line 112):

    before: $wpfbogp_url = get_bloginfo( 'url' );
    after: $wpfbogp_url = get_bloginfo( 'url' ) . '/';

    I don't know if this breaks anything now or in the future because it concerns only the homepage and Facebook seems to add the trailing slash in the url field regardless if it is in the url field in Facebook application settings. It is always possible that FB will stop modifying the url field content in the future.

    Your competitor has found out the same problem and decided to make tariling slash optional :) See version 0.1.9 in http://wordpress.org/extend/plugins/wonderm00ns-simple-facebook-open-graph-tags/changelog/

    http://wordpress.org/extend/plugins/wp-facebook-open-graph-protocol/

  2. Andrew Ryno
    Member
    Plugin Author

    Posted 2 years ago #

    In the next version I'll tralingslashit() the blog URL so this doesn't come up. Didn't think that Facebook would be that strict (and I didn't run into this problem in testing).

  3. danpro
    Member
    Posted 2 years ago #

    I've just seen this error on lint. It definitely wasn't there when I introduced OGP to my site a few months ago.

    To satisfy lint I've had to set my homepage to use:
    <meta property="og:url" content="<? echo site_url(); ?>/"/> (with extra slash)

    and when on a post page, I've used:
    <meta property="og:url" content="<? echo the_permalink(); ?>"/>

    That seems to work...for now

  4. Chuck Reynolds
    Member
    Plugin Author

    Posted 2 years ago #

    afaik this is handled in past updates. closing.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic