Skip to content

Templating app.html #3091

@ebeloded

Description

@ebeloded

Describe the problem

Currently SvelteKit templating is fairly simple: it replaces %svelte.head% and %svelte.body% entries in app.html.

However, sometimes it is necessary to augment some parts of app.html that are outside of Svelte's control.

For example, for i18n one needs to be able to change the lang attribute on <html> or set a class on <body> tag.

Describe the proposed solution

It would be useful if SvelteKit provided some built-in templating solution for app.html that extends beyond replacing %svelte.head% and %svelte.body% and provides access other request parameters.

Alternatives considered

It is possible to do such templating in handle hook. For example, we can define some logic in app.html in EJS format and then run the templating engine on response.body before returning it from the hook.

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions