Skip to main content
This element makes it possible to insert elements into document.head. During server-side rendering, head content is exposed separately to the main body content.
As with <svelte:window>, <svelte:document> and <svelte:body>, this element may only appear at the top level of your component and must never be inside a block or element.

Usage

Basic meta tags

Dynamic page title

OpenGraph meta tags

Stylesheets and fonts

Favicon

Canonical URL

Inline styles

Script tags

Viewport and mobile optimization

Language and character encoding

Server-Side Rendering

During server-side rendering, the content of <svelte:head> is extracted separately from the body content. This allows you to insert the head content into the HTML document’s <head> section:

Multiple svelte:head Elements

If multiple components define <svelte:head> elements, their contents will be combined. Later elements will appear after earlier ones in the document head.