user35546
user35546

Reputation: 65

Blanket hreflang or lang attribute for single language website

My marketing team is on me to fix Site Audit errors reported by Semrush and Ahrefs.

The error is: "218 pages have no hreflang and lang attributes"

This is a single language site - all in US English. I realize I can go into 218 pages and change < html > to < html lang="en" >. However, my full site is more than 2000 pages so I think the 218 count is just that site audit stopped there.

I'd like to just put a default in the page header for all pages. I see the syntax for hreflang alternate, but I don't think it's right for a single language site.

Is there a way for me to add a blanket default that makes semrush site audit know that all my pages are lang="en" ?

Upvotes: 0

Views: 206

Answers (1)

maneroto
maneroto

Reputation: 163

If you have a common header and all that pages are part of the same domain, you can use
<link rel="alternate" hreflang="x-default" href="https://www.yourURL.com<?php echo $_SERVER["REQUEST_URI"]; ?>" />
in the head and the "x-default" handles the language for you. Here is a url that explains better the usage of 'x-default': https://webmasters.googleblog.com/2013/04/x-default-hreflang-for-international-pages.html
I hope it helps.

Upvotes: 0

Related Questions