Accessibility and space in language identifier <html >

L Younkins asked on April 10, 2023 16:01

Our accessibility scan says Page language has not been identified. The cms is adding a space before the closing > tag in the html tag. When I look at the master page, the space is not there, but if I look at the source code on any page on our site, it is there. www.frederick.edu This is causing us to fail accessibility.

Correct Answer

Trevor Fayas answered on April 10, 2023 17:52

under the CMS folder.

CMS/CMSPages/PortalTemplate.aspx

Edit the line:

<html <%=XHtmlNameSpace%> <%=XmlNamespace%>>

to

<html <%=XHtmlNameSpace%> <%=XmlNamespace%> <%=OtherHeaderTags%>>

Then in the PortalTemplate.aspx.cs file, edit the OnPreRender as below:

protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);

    // Init the header tags
    tags.Text = HeaderTags;
    OtherHeaderTags = string.Format("lang=\"{0}\" xml:lang=\"{0}\"", LocalizationContext.CurrentCulture.CultureCode.Split('-')[0]);
}
0 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on April 10, 2023 16:41

That accessability scan is not about having a space, it's about how the <html> tag is missing the lang parameter <html lang="en">

You can modify the CMSPages/PortalTemplate.ascx and it's code behind to program in the lang with the LocalizationContext.CurrentCulture's culture code to fix this.

0 votesVote for this answer Mark as a Correct answer

L Younkins answered on April 10, 2023 16:45

How do I do that? In the master page?

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on April 10, 2023 16:48

You have to do it in code, so you would need to go to the actual code to add the lang tag. I know, not ideal, but that's the only way to modify the

0 votesVote for this answer Mark as a Correct answer

L Younkins answered on April 10, 2023 16:51 (last edited on April 10, 2023 16:52)

Where do I modify the code for this section? When I look at the master page, the part with the headings isn't editable.

 <html>
  <head>
    <title>
0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on April 10, 2023 16:57

Again, you cannot edit this through the admin portal.

You must edit this through the actual code files in the Kentico C# Solution

You have to have a developer modify the CMSPages/PortalTemplate.aspx file in the code to add the language onto it.

0 votesVote for this answer Mark as a Correct answer

L Younkins answered on April 10, 2023 17:01

Under templates? Master template? I have access to those. I am pretty good with code, I just need to know where within the cms structure it is located. We do not have a back end developer. I need to figure out how to do this.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.