headElements() — astro Function Reference
Architecture documentation for the headElements() function in pipeline.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD ae6e11fc_8ccf_dae6_d672_ef52a3f8715e["headElements()"] c3b8b169_18bd_e1ba_12e9_03f51391d4e3["AppPipeline"] ae6e11fc_8ccf_dae6_d672_ef52a3f8715e -->|defined in| c3b8b169_18bd_e1ba_12e9_03f51391d4e3 style ae6e11fc_8ccf_dae6_d672_ef52a3f8715e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/core/app/pipeline.ts lines 53–76
async headElements(routeData: RouteData): Promise<HeadElements> {
const { assetsPrefix, base } = this.manifest;
const routeInfo = this.manifest.routes.find(
(route) => route.routeData.route === routeData.route,
);
// may be used in the future for handling rel=modulepreload, rel=icon, rel=manifest etc.
const links = new Set<never>();
const scripts = new Set<SSRElement>();
const styles = createStylesheetElementSet(routeInfo?.styles ?? [], base, assetsPrefix);
for (const script of routeInfo?.scripts ?? []) {
if ('stage' in script) {
if (script.stage === 'head-inline') {
scripts.add({
props: {},
children: script.children,
});
}
} else {
scripts.add(createModuleScriptElement(script, base, assetsPrefix));
}
}
return { links, styles, scripts };
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does headElements() do?
headElements() is a function in the astro codebase, defined in packages/astro/src/core/app/pipeline.ts.
Where is headElements() defined?
headElements() is defined in packages/astro/src/core/app/pipeline.ts at line 53.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free