March 23, 2018

social tag

There are many plugins that insert meta tags for Facebook/google/twitter (like og:title ...) in header of website  (like Heateor or Webdados or WPFOP, which offer many customizations). However, many of existing plugins doesnt include the correct logic and are incomplete plugins. I think the complete and useful plugin should have:

====1) The logic of tags====

First of all, I think those plugins SHOULD HAVE individual fields on each post/page/custom-post  EDITOR page,  where we can fill open-graph title,description, url and image fields (like "Complete Open Graph" plugin has). In case we don't fill it, those fields should be defaulted to post-title, excerpt of content(in case excerpt not filled, then grab sanitized text from content, like TGFMT does) and featured image (plugin should enable 'featured-images' using this command  add_theme_support('post-thumbnails'); ).

Also, all those plugins should add a special separate SETTINGS page in Dashboard.Because:

In case featured image is not chosen too, then it should be defaulted to the DEFAULT IMAGE - that option should be available in "settings" page.  Also, there should be special fields for HOMEPAGE (where we can set default TITLE, Description and image for Homepage... if title and description fields are not filled, then it should defaulted to website TITLE/DESCRIPTION phrases).

Also, there should be conditional tags for each is_BLABLA() types:
For them, the og-Titles should be defaulted to their native title (same for description)..  But og-Images field should be available individually for them in "SETTINGS" page. In case, those fields are not filled, then the image should be defaulted to global OG:IMAGE (chosen in the top of the same "SETTINGS PAGE"). As an exlucsion, some plugins allow (but that should be OFF by default) to set image from post (in case not featured image is chosen), before accessing global OG:IMAGE.

====2) Description tag ====

At first, many of those plugins doesnt offer to include the "description" tag for general purpose (<meta name="description" content="....">). I know, google probably no longer uses that tag, but at least, plugin should have options page, where we can enable/disable that field.

====3) Let me Change them! ====

all those fields before output, should be editable with filter  (we should be able to modify output using hooks..)

====4) encode images ! ====

image urls (only the name of image, or maybe the other parts too?) should be encoded, for example, instead of:
http://example.com/folder+name/image+name.jpg     should be:
 
http://example.com/folder+name/image%20name.jpg
i used this function to filter url:
//echo myIMGurlencode('http://example.com/folder+name/image+name.jpg');
function myIMGurlencode($imgUrl){
      return str_replace('/'.basename($imgURL) ,  '/'.str_replace('+','%20',basename($imgURL)),       $imgURL);
}

====5) tags for fb:admins ====

Many of plugins doesnt have fb:app_id  and  fb:admins (comma separated list is possible too) tags. These tags are important thing in most cases ( These fields should be available in SETTINGS page as well).