Skip to main content

Why is my site getting flagged for "Language of page has not been set"?

Modified on: Mon, 22 Feb, 2021 at 4:45 PM

If you notice pages on your site are getting flagged within Accessibility for the accessibility issue "Language of page has not been set," even when you've declared the language of the page, then you need to ensure that you've added the correct language attribute for the type of page.


For a standard HTML document, the attribute should be formatted like this:


lang="en"

However, if your document type is XHTML, then you have to use a slightly different language attribute to declare the language of the page. The XHTML language attribute is formatted like this:


xml:lang="en"

If you're not sure what document type you're using on your site, then you can usually review the !DOCTYPE declaration at the top of the page when you view the HTML source. If you see some variation of the following, specifically if you see XHTML in the declaration of the document, then your page is an XHTML document:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"

For all variations on doctypes you can review the HTML <!DOCTYPE> Declaration page from W3, which includes the common formats for all doctype declarations.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.