To set the lang
attribute on the <html>
tag for a specific page in your multilingual Webflow site, you need to use a small script since Webflow doesn’t allow direct editing of the <html>
tag per page.
en
, es
, fr
) in your script.Go to Pages panel in your Webflow Designer.
Hover over the specific page and click the gear icon to open Page Settings.
Scroll down to the "Before
tag" or "Inside " section.
Paste the following inline script, updating "en"
with your desired language code:
<script>document.documentElement.lang = "en";</script>
<script>document.documentElement.lang = "es";</script>
<script>document.documentElement.lang = "fr";</script>
Add a small inline script via Page Settings to change the lang
attribute on the <html>
tag per page. This ensures accessibility and SEO optimization for multilingual sites.