Home / Function/ getEntrySlug() — astro Function Reference

getEntrySlug() — astro Function Reference

Architecture documentation for the getEntrySlug() function in utils.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  1ed6fe42_279b_7827_1f5b_d69952bde3cc["getEntrySlug()"]
  7a09e708_c090_71c0_8138_7343699b1865["utils.ts"]
  1ed6fe42_279b_7827_1f5b_d69952bde3cc -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865
  cee93cfc_797d_10f9_7ee1_711ec98a59da["parseEntrySlug()"]
  1ed6fe42_279b_7827_1f5b_d69952bde3cc -->|calls| cee93cfc_797d_10f9_7ee1_711ec98a59da
  style 1ed6fe42_279b_7827_1f5b_d69952bde3cc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/utils.ts lines 811–838

export async function getEntrySlug({
	id,
	collection,
	generatedSlug,
	contentEntryType,
	fileUrl,
	fs,
}: {
	fs: typeof fsMod;
	id: string;
	collection: string;
	generatedSlug: string;
	fileUrl: URL;
	contentEntryType: Pick<ContentEntryType, 'getEntryInfo'>;
}) {
	let contents: string;
	try {
		contents = await fs.promises.readFile(fileUrl, 'utf-8');
	} catch (e) {
		// File contents should exist. Raise unexpected error as "unknown" if not.
		throw new AstroError(AstroErrorData.UnknownContentCollectionError, { cause: e });
	}
	const { slug: frontmatterSlug } = await contentEntryType.getEntryInfo({
		fileUrl,
		contents,
	});
	return parseEntrySlug({ generatedSlug, frontmatterSlug, id, collection });
}

Subdomains

Frequently Asked Questions

What does getEntrySlug() do?
getEntrySlug() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is getEntrySlug() defined?
getEntrySlug() is defined in packages/astro/src/content/utils.ts at line 811.
What does getEntrySlug() call?
getEntrySlug() calls 1 function(s): parseEntrySlug.

Analyze Your Own Codebase

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

Try Supermodel Free