Add Language To HTML Tag

Red Door Technical asked on June 26, 2020 23:26

Is there a way to add the Language to the HTML tag without editing the Master page template file?

Recent Answers

Brenden Kehren answered on June 26, 2020 23:48 (last edited on June 26, 2020 23:49)

I'm assuming you're using Portal Engine. You can add this code to the master page template at the beginning of the layout.

<script runat="server">
  protected void Page_Load(object sender, EventArgs e)
      if (CurrentDocument != null)
        CMS.UIControls.ContentPage page= this.Page as CMS.UIControls.ContentPage;
        if (page != null)
          string lang= CMS.Localization.LocalizationContext.CurrentCulture.CultureCode;
          page.XmlNamespace += " lang=\"" + lang + "\"";

This is editing the master page portal engine and not the base Kentico master template.

1 votesVote for this answer Mark as a Correct answer

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