Skip to content

How to set the "lang" attribute programatically? In a +page.server.ts for example #12374

Description

@Antoine-lb

Describe the problem

Hello 👋
If I have a blog where each article can be in a different language, the recomended version on how to handle the lang attribute falls short.

This is because I only know what language the page is when I load the article (in the +page.server.ts), but the transformPageChunk already returned.

This problem is very annoying bc if not done right, on some Androids Google will just translate the site without asking (is a opt out) just based on this lang attribute. And Google translate is very bad at translating.

Describe the proposed solution

Using <svelte:head> to modify the <html> tag. Like a <svelte:html>.

Alternatives considered

Run transformPageChunk in a load function.

Importance

would make my life easier

Additional Information

Other people with the same problem:

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