Skip to content

Allow configuring <html lang> attribute #84

Open

Description

@CharlonTank

Problem

The Lamdera compiler injects a wrapper <html lang="en"> around the app's index.html, hardcoding the language to English regardless of the actual page language.

This is problematic for:

  • SEO: Google uses the lang attribute to understand page language
  • Accessibility: Screen readers rely on it for pronunciation
  • Multi-language apps: Apps serving content in French, Spanish, etc. are incorrectly marked as English

Current behavior

Even if public/index.html specifies <html lang="fr">, the served page contains:

<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <style>body { padding: 0; margin: 0; }</style>
  <!-- then the user's index.html head content -->

The lang="en" is injected by the compiler/runtime and cannot be overridden.

Expected behavior

Either:

  1. Respect the lang attribute from the user's index.html
  2. Omit the lang attribute entirely and let the user's index.html control it

Workaround

Currently using a Cloudflare Worker with HTMLRewriter to rewrite the lang attribute for crawlers, but this shouldn't be necessary.

Environment

  • Lamdera compiler: latest (March 2026)
  • Affects all Lamdera apps serving non-English content

Activity

  1. miniBill commented on Mar 19, 2026

    @miniBill
    Member

    You can set the lang attribute on the elements inside the body. This is not perfect, SEO will still be wrong, but it could help with accessibility

  2. added a commit that references this issue on Mar 31, 2026
    dbee96a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions