WordPress SEO Optimization: add og protocol tag

If you look at the source code of some mainstream web sites, you can often see some meta tags of og: type, og: title and og: image in the HTTP header. What are these OG? What's the usage? In view of these problems, the insect fungus has sorted out the following information for you.

What is OG protocol?

<meta property="og:locale" content="en-US" />

<meta property="og:type" content="article" />

< meta property = og: image "content = article image / >

< meta property = og: title "content = article title / >

< meta property = og: description "content = article description / >

<meta property="og:url" content=" https://www.nicebrian.com/24.html " />

<meta property="og:updated_ time" content="2021-02-03T19:18:03+08:00" />

<meta property="og:site_ name" content="BrianBlog" />

After adding the og protocol, the head tag in the head of the web page source code will have the above effect.

These OGS are short for open graph protocol, which was announced by Facebook after 2010. At present, they are supported by mainstream search engines or social networking sites such as Baidu, Google, youtube and twitter. They are very good SEO optimization tools.

Common values of og protocol

og: locale / / website language

og: type / / type (common values: website; Article; book; movie)

og: title / / Title

og: description / / a brief description of the page

og: URL / / current content link

og: video / / video

og: audio / / audio

og: photo / / picture

og: product / / product

og: image / / thumbnail

og: link / / link

og:site_ Name / / the name of the website where the page is located

og: audiosrc / / audio address

RR: appid / / if your website is connect to renren.com Please provide the ID

og: videosrc / / link to video resources, such as the flash address where the video can be played

og: width / / width of video and picture

og: height / / height of video and picture

og: Artist / / musician

og: ContentID / / the ID of the content body, which is used to identify the ID of the HTML tag where the main content of the current page is located

og: price / / product price

og: Nick / / shop name

og: postfee / / freight

Pay attention to two points

First point:

A web page can repeat the same meta tag. Generally, the og: type tag is used to divide it. That is to say, the og: type tag is the beginning of each section of content

<meta property="og:type" content="video"/>

< meta property = og: title "content = article title / >

< meta property = og: image "content = article image / >

Omit.....

<meta property="og:type" content="video"/>

< meta property = og: title "content = text description / >

< meta property = og: image "content = article image / >

Omit...

Second point:

We know that og: type can be used to mark the type of a web page. In WordPress, web is generally used for the home page and list page, and article is generally used for the article page. The following is a specific example:

Website home page, list page:

<meta property="og:type" content="website" />

Website article page:

<meta property="og:type" content="article" />

How to add og protocol label to WordPress

You can add og protocol tags to your WordPress through pure code or plug-ins. The common plug-ins are Yoast SEO or the SEO framework (the SEO framework has better performance and caching function)

How to use pure code addition? A code is provided below to add to the WordPress theme header.php In the head tag of the file.

if (is_singular()) {
<meta property="og:locale" content="zh_CN" />
<meta property="og:type" content="acticle">
<meta property="og:title" content="<?php wp_get_document_title();?>">
<meta property="og:site_name" content="<?php bloginfo('name');?>">
<meta property="og:description" content="<?php the_excerpt();?>">
<meta property="og:url" content="<?php the_permalink();?>"/>
<meta property="og:image" content="<?php wpjam_post_thumbnail();?>">
}

Original article, author: brian, if reprinted, please indicate the source:https://www.nicebrian.com/24.html

Leave a Reply

Your email address will not be published. Required fields are marked *