Skip to main content

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

Adam McGrath avatar


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.

Was this article helpful?

0 out of 1 found this helpful