SmartCrawl: Can you change the og:url output when canonical url is specified?

We build websites for clients in the same industry, and have some “stock content” that we offer to our clients if they neglect to write their own. In this case, we are supplying generic “starter blog posts”.

We don’t want our clients to get penalized for duplicate content, so we always put a canonical url to the main source – however, when our clients share their blog post on social media the og:url is pointing back to the original source, our site.

Is there a way to change the og:url to be the url of the article, not the canonical?

  • Kasia Swiderska
    • Support nomad

    Hello Spectora ,

    It looks like it’s not possible to change it manually from post or settings – however, let me check with our Second Line Support developers if there is any filter we could use to change URL only for the og:url.

    I will escalate this and if there is any way to do that our developers will update here.

    kind regards,

    Kasia

  • Panos
    • SLS

    Hi there Spectora !

    Ideally we could remove that upon site creation and replace all those posts metas. If you are interested in that, you can explain how you create those new sites so we could try replicate and possibly come with a snippet that would do this replacement automatically.

    Else you can try adding the following snippet in a mu-plugin:

    add_filter( 'wds_filter_canonical', function( $canonical_url ){

    if ( is_singular() ) {
    $parts = (object) wp_parse_url( $canonical_url );
    $site_url = get_site_url( null, '', $parts->scheme );
    $canonical_url = "{$site_url}{$parts->path}";
    }

    return $canonical_url;
    } );

    If you are not familiar with mu-plugins, you can read more about them here :

    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.