template() — astro Function Reference
Architecture documentation for the template() function in 4xx.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 91253924_739f_881f_85ec_9ccad58d1384["template()"] 290d338a_b86f_3c08_2047_f178684bb43d["4xx.ts"] 91253924_739f_881f_85ec_9ccad58d1384 -->|defined in| 290d338a_b86f_3c08_2047_f178684bb43d 9c96b7b3_d2d3_bce8_170d_925846d18f0c["subpathNotUsedTemplate()"] 9c96b7b3_d2d3_bce8_170d_925846d18f0c -->|calls| 91253924_739f_881f_85ec_9ccad58d1384 999d15d6_67fd_38a9_4a32_1e26631a95c4["trailingSlashMismatchTemplate()"] 999d15d6_67fd_38a9_4a32_1e26631a95c4 -->|calls| 91253924_739f_881f_85ec_9ccad58d1384 6ee37dd6_60fc_54a8_4f87_2108dfca595f["notFoundTemplate()"] 6ee37dd6_60fc_54a8_4f87_2108dfca595f -->|calls| 91253924_739f_881f_85ec_9ccad58d1384 style 91253924_739f_881f_85ec_9ccad58d1384 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/template/4xx.ts lines 18–120
export default function template({
title,
pathname,
statusCode = 404,
tabTitle,
body,
}: ErrorTemplateOptions): string {
return `<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>${tabTitle}</title>
<style>
:root {
--gray-10: hsl(258, 7%, 10%);
--gray-20: hsl(258, 7%, 20%);
--gray-30: hsl(258, 7%, 30%);
--gray-40: hsl(258, 7%, 40%);
--gray-50: hsl(258, 7%, 50%);
--gray-60: hsl(258, 7%, 60%);
--gray-70: hsl(258, 7%, 70%);
--gray-80: hsl(258, 7%, 80%);
--gray-90: hsl(258, 7%, 90%);
--black: #13151A;
--accent-light: #E0CCFA;
}
* {
box-sizing: border-box;
}
html {
background: var(--black);
color-scheme: dark;
accent-color: var(--accent-light);
}
body {
background-color: var(--gray-10);
color: var(--gray-80);
font-family: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
line-height: 1.5;
margin: 0;
}
a {
color: var(--accent-light);
}
.center {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
}
h1 {
margin-bottom: 8px;
color: white;
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-weight: 700;
margin-top: 1rem;
margin-bottom: 0;
}
.statusCode {
color: var(--accent-light);
}
.astro-icon {
height: 124px;
width: 124px;
}
pre, code {
padding: 2px 8px;
background: rgba(0,0,0, 0.25);
border: 1px solid rgba(255,255,255, 0.25);
border-radius: 4px;
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does template() do?
template() is a function in the astro codebase, defined in packages/astro/src/template/4xx.ts.
Where is template() defined?
template() is defined in packages/astro/src/template/4xx.ts at line 18.
What calls template()?
template() is called by 3 function(s): notFoundTemplate, subpathNotUsedTemplate, trailingSlashMismatchTemplate.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free