Search code examples
asp.netsharepointsharepoint-2013master-pages

How do you add an attribute to the html tag in SharePoint masterpages?


I want to turn the following tag produced in SharePoint 2013 master pages:

<html dir="ltr" lang="en-US">

into the following:

<html dir="ltr" lang="en-US" **xml:lang=”en”**>

It is controlled by the following:

<SharePoint:SPHtmlTag dir="<%$Resources:wss,multipages_direction_dir_value%>" 
                      ID="SPHtmlTag"
                      runat="server" >

Solution

  • I think you are out of luck as that control and the asp.net Control superclasses don't appear to give you an option to set/generate the xml:lang attribute. You could convert:

    <SharePoint:SPHtmlTag dir="<%$Resources:wss,multipages_direction_dir_value%>" 
                          ID="SPHtmlTag"
                          runat="server" >
    

    to something like:

    <html ID="SPHtmlTag" runat="server" xml:lang="en" dir="ltr" >
    

    but you'd be missing out on anything else that control was doing for you.