HTML language settings for websites

Hello, I am building a website in Italian, so I would like HTML pages to start with html lang"it". Is there any way to set it?

I’m not quite sure what you want to achieve, but you can set the “language” metatag for your site. In Rapidweaver 6, open the Configure tab (wrench icon), select Code and you will find a table for metatags. Create a new metatag and give it the name “language” and content “it”. This will then appear in the head section (source code) of your site.

Thank you, I have set the metatag as suggested; now the page shows:

The language metatag is there in line 10, but line 3 still defaults to English, I hope this is not contradictory to search engines!

Hmm. I would think the theme is responsible for this. Which theme are you using? I don’t know a way to change the html lang within Rapidweaver.

If you are using stacks, have you checked them for any language settings? Or your plugins? I’m not seeing html lang on any of my sites so I don’t think Rapidweaver is adding it. So it must be either a theme, a plugin, or a stack.

Ha, not quite right. I have one site (a local test site currently) that displays this html lang! It’s running on one Multithemes theme. So a theme really might be the culprit, I suspect.

You can actually do this with the Foundation, see this screenshot:

1 Like

The Theme is Breeze from ThemeFlood, and I am using it together with Stacks

One more info: the sitemap page uses a Rapidweaver plugin without Stacks and it too starts the pages with lang=en", so Stacks should not be the culprit

If you look at the source code of Breeze’s demo site, html lang =“en” is there. I did some research with different themes from different developers and mostly those that I looked at didn’t define the site’s language. But some do. I contacted Multithemes about this myself, as I suspect it might be the reason why hyphenation code is not working - it depends on the site’s language. Perhaps you could ask ThemeFlood about this too?

This is actually in the theme’s index.html file. You can modify that there.

As always with modifying themes, you should make a back-up of it, or, duplicate it for your change purposes.

If you look in the index.html file, you’ll see the various language settings at the top, and it should be safe to change it there.

The lang attribute (in the HTML element just below the Doctype declaration) and the Content-Language HTTP header (in the meta section) are similar but they are not the same: The HTML element specifies the language the document is written in. The Content-Language HTTP header (= meta tag) specifies the language of the intended audience (that must not be the language the document is written in).

If the theme defines a language in the HTML element, it is difficult to change that. The only way possible is editing the index.html in the theme package (see post of JCMII)

@zeebe I saw the option to choose a language in the Site Styles stack of the Foundation theme. But I could not find out where in the source code of the HTML document the language will be defined

Thanks for confirming and pointing this out JCMII. Hacking a theme is not an ideal solution though. When there is an update to the theme, it’s a bother. And editing the theme index file doesn’t happen exactly inside Rapidweaver… after all, this is what Rapidweaver and themes promise: no coding. I don’t think a theme should determine the site’s language like this. English might seem like a norm but I think there are thousands of non-English users and sites.

What do you mean: why the language shouldn’t be the same in the meta tag as in the html lang? If the whole site content is in Italian, shouldn’t it be html lang=“it”, regardless of meta tags?

If the content is in Italian you can write html lang=it to define the language the document is written in. But the language must not be the same as the country of the audience. It can be the same but it must not. The language of the audience you define by a language meta tag in the head

For reference:

See here:

You might also find this useful:

BTW, theme modification is not discouraged in RW. There are some things that just can’t be done via the stock theme, nor any of the methods RW provides. As such, the creators of RW allow for theme modification (and even help you by pointing out where the them resides).

Yes, I am aware of what happens when a theme gets updated (it could be ugly to a modified theme), however, if you ask the theme dev nicely, he/she/it may tell you what was changed so you can update your mod.

Additionally, I don’t think RW ever promised code-free web creation - that’s a fantasy. Very simple sites, sure, however, most people want something with pizzazz which may not be accomplished without code injection here and there. Database interaction would be a very easy case to think of, or special animations.

So, if you want to change the site’s base language, you have to do it with the lang= attribute of the <html> tag which can only be done (if the theme does not support it) via theme mod.

Thank you very much to everybody and to JCMII in particular. I have also checked with Will Woodgate, who has developed the theme: tweaking the index.html file of the theme is the right way to do it, at least until Realmacsoftware implements a language setting in Rapidweaver. I did it and it works perfectly.


1 Like

Foundation sets the language via JS on the fly in the browser. If you look at the DOM inside the Page Inspector for a webpage, you will see the the language is indeed applied.

1 Like

But all my SEO Tools are saying that my language is not set. So what else can i do?

That is because they are not smart. They are just parsing the source code…

1 Like