Naibabiji installed the AMP plugin recommended by Google, and today received a notification from Google that there is an error in the AMP URL, one of which is „
Required structured data elements are incorrect”

How to Fix „Required Structured Data Elements Are Incorrect“
The solution is very simple. Use the Google Structured Data Testing Tool, paste the source code of the page with the error, and then check to find out the problem. Google Structured Data Testing Tool address:
https://search.google.com/structured-data/testing-toolRequired Structured Data Elements Error One: logo
The error that occurred on Naibabiji is that the logo address is missing, as shown in the figure below.

Now that the problem has been identified, it's easy to solve. Go to the WordPress admin panel, select the Customize function under Appearance. In the Site Identity section, upload a site icon, and then test again; the problem will be gone.

Required Structured Data Elements Error Two: image
If you still encounter an image error, it's because you haven't uploaded a featured image. There are three solutions: 1. Manually add a featured image to the article. 2. Use a random featured image plugin to batch add featured images to articles.
WordPress Random Featured Image Plugin: Random Post Thumbnails3. Use code to set a default featured image for the AMP page. The code is as follows (Naiba has not tested this):
//修正 AMP image 錯誤
function bbm_amp_modify_json_metadata( $metadata, $post ) {
if (!array_key_exists('image', $metadata)) {
$metadata['image'] = array(
'@type' => 'ImageObject',
'url' => get_template_directory_uri() . '/image/default.png',
'height' => 512,
'width' => 1024,
);
}
return $metadata;
}
add_filter( 'amp_post_template_metadata', 'bbm_amp_modify_json_metadata', 10, 2 );The above solutions refer to
Yigujin's article。
What is AMP?
AMP stands for Accelerated Mobile Pages. It is a solution launched by Google to accelerate website access speed on mobile devices. Simply put, the AMP workflow re-encodes your website, discarding various useless code and leaving only the content. Additionally, Baidu now also indexes AMP pages. If you are interested, you can directly search for and install AMP in the WordPress admin panel. For example, the AMP page for this article is:
https://blog.naibabiji.com/skill/amp-jie-gou-hua-yuan-su.html/ampHow to Enable AMP?
If you are using WordPress, enabling AMP only requires installing an AMP plugin in the admin panel.
Download Link
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.