Home / File/ 3xx.ts — astro Source File

3xx.ts — astro Source File

Architecture documentation for 3xx.ts, a typescript file in the astro codebase.

Entity Profile

Relationship Graph

Source Code

type RedirectTemplate = {
	from?: string;
	absoluteLocation: string | URL;
	status: number;
	relativeLocation: string;
};

export function redirectTemplate({
	status,
	absoluteLocation,
	relativeLocation,
	from,
}: RedirectTemplate) {
	// A short delay causes Google to interpret the redirect as temporary.
	// https://developers.google.com/search/docs/crawling-indexing/301-redirects#metarefresh
	const delay = status === 302 ? 2 : 0;
	return `<!doctype html>
<title>Redirecting to: ${relativeLocation}</title>
<meta http-equiv="refresh" content="${delay};url=${relativeLocation}">
<meta name="robots" content="noindex">
<link rel="canonical" href="${absoluteLocation}">
<body>
	<a href="${relativeLocation}">Redirecting ${from ? `from <code>${from}</code> ` : ''}to <code>${relativeLocation}</code></a>
</body>`;
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does 3xx.ts do?
3xx.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in 3xx.ts?
3xx.ts defines 1 function(s): redirectTemplate.
Where is 3xx.ts in the architecture?
3xx.ts is located at packages/astro/src/core/routing/3xx.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/routing).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free