Support » Plugin: Meta Tag Manager » Meta Tag Manager and LinkedIn

  • Hi,

    I was wondering if anyone is using Meta Tag Manager for creating WP posts that have the appropriate metadata for a LinkedIn post?

    For example, LinkedIn expects open graph metadata in the format
    <meta name=”image” property=”og:image” content=”[Image URL here]”>

    But from what I can tell, MTM can only include two tags inside the brackets, not three…? For example, I can use MTM to do
    <meta property=”og:image” content=”[Image URL here]”>
    or
    <meta name=”image” content=”[Image URL here]”>
    but not put all three parts inside. I have a feeling this might be why LinkedIn isn’t always scraping the right information from my pages.

    Am I missing something, or is there a workaround?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Marcus

    (@netweblogic)

    Hi, it seems property isn’t something in the HTML standards but is widely used via RDFa

    Unfortunately, I can’t see an easy way to add this as we don’t have filters, I’ve added this as a ‘todo’ feature, but currently due to time constraints, it’ll be a while.

    Thread Starter wwpressww

    (@wwpressww)

    Hi Marcus,

    Many thanks for the response! I do hope you can implement something to make MTM more compatible (and customizable/extensible) for closer integration with posts to LinkedIn and Facebook. This was the main reason I installed MTM, which I thought would be a light weight solution — but I might have to swap to another solution if it’s too far down your to-do list and won’t be addressed for too long of “a while”.

    Thanks again.

    Plugin Author Marcus

    (@netweblogic)

    Yup, I’d love to see it happen sooner, but it’s a time-issue, I just don’t have any right now 🙂 Maybe in a few weeks this may be possible.

    What I could do now is add a filter and provide a simple snippet that’d convert things with name=”image” to name=”image” property=”og:image”, would that work? You may need to modify it to expand on further properties, e.g. copy/paste one line and modify the text.

    Thread Starter wwpressww

    (@wwpressww)

    I think your simple quick fix could work, if the instructions on how to install/use the snippet fall within my level of expertise (not a superuser). Worth a try I suppose, and perhaps I can get some help from a local if needed.

    Thanks!

    Plugin Author Marcus

    (@netweblogic)

    OK, so get the development version from here:
    https://wordpress.org/plugins/meta-tag-manager/advanced/

    Then add this filter to your functions.php file in your theme, or somewhere else appropriate:

    add_filter('mtm_tag_output', function( $tag_string, $MTM_Tag ){ /* @var MTM_Tag $MTM_Tag */
    	if( $MTM_Tag->type == 'name' ){
    		$values = array('image'); // add to this for more tags
    		if( in_array($MTM_Tag->value, $values) ){
    			$tag_string = str_replace('name=', 'property="og:'.$MTM_Tag->value.'" name=', $tag_string);
    		}
    	}
    	return $tag_string;
    }, 10, 2);

    if you want MTM to make it happen for description too, for example, then add it to the array like so:

    $values = array('image', 'description'); // add to this for more tags

    Hope that helps! We’ll probably be making some sort of automated way to handle this in the future, but I dont’ know when exactly.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.