Skip to content

Base

Base renders a <base> tag that sets the default base URL and browsing context for relative links and form submissions within the document. It is scoped to emitting the <base> tag only and does not perform URL validation or resolution.

proptypedefaultrequireddescription
hrefstring-NoBase URL used for resolving all relative URLs in the document.
targetstring-NoDefault browsing context for links and forms in the document.

Input:

<Base href="https://example.com" />

Output:

<base href="https://example.com" />

Uses the integration headTags.base value when no prop is provided.

Input:

// in astro.config.mjs integration config
eminence({
headTags: {
base: {
href: "https://example.com",
target: "_blank",
},
},
});
```astro
<Base />

Output:

<base href="https://example.com" target="_blank" />

Input:

<Base href="https://example.com" target="_blank" />

Output:

<base href="https://example.com" target="_blank" />

Optional props with fallback to integration config

Section titled “Optional props with fallback to integration config”

If any prop is provided it overrides all the integration config values. If no props are provided, the component falls back to using the integration config values for head.base.href and head.base.target if they are set.