Cilacap.info English – We check search engine optimization (SEO) tools on Semrush, but we found issue on meta title.
On Semrush detect duplicate title tags from non AMP and AMP (Accelerated Mobile Pages), because problem this, then we are trying to fix it.
We think that most appropriate solution to prevent duplicate meta title tags in WordPress is to add an attribute in AMP page with name “Mobile Version”.
The method is not so difficult, you can use add_filter with document_title_parts attribute on functions.php.
Then don’t forget to add if (function_exists(‘is_amp_endpoint’) && is_amp_endpoint()) { // do stuff } so that name “Mobile Version” is only found on AMP pages.
If theme you are using supports amp, then you can use if(nametheme_is_amp()).
Okay this code can you use and add on fuctions.php in your theme.
add_filter(‘document_title_parts’, function($title) {
if (mytheme_is_amp())
$title[‘amp’] = ‘Mobile Version’;
return $title;
});
Don’t forget, change mytheme_is_amp with your theme if your theme support amp paired with plugins AMP.