Home / Function/ getEntryType() — astro Function Reference

getEntryType() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e9eac359_83b6_182d_4bbe_8249d11e3d5f["getEntryType()"]
  7a09e708_c090_71c0_8138_7343699b1865["utils.ts"]
  e9eac359_83b6_182d_4bbe_8249d11e3d5f -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865
  c3eb6949_3bd8_b429_3144_2bec935dbdb8["hasUnderscoreBelowContentDirectoryPath()"]
  e9eac359_83b6_182d_4bbe_8249d11e3d5f -->|calls| c3eb6949_3bd8_b429_3144_2bec935dbdb8
  2749e846_3241_0979_602a_7e63b6672296["isParentDirectory()"]
  e9eac359_83b6_182d_4bbe_8249d11e3d5f -->|calls| 2749e846_3241_0979_602a_7e63b6672296
  style e9eac359_83b6_182d_4bbe_8249d11e3d5f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/utils.ts lines 396–420

export function getEntryType(
	entryPath: string,
	paths: Pick<ContentPaths, 'config' | 'contentDir' | 'root'>,
	contentFileExts: string[],
	dataFileExts: string[],
): 'content' | 'data' | 'config' | 'ignored' {
	const { ext } = path.parse(entryPath);
	const fileUrl = pathToFileURL(entryPath);

	const dotAstroDir = new URL('./.astro/', paths.root);

	if (fileUrl.href === paths.config.url.href) {
		return 'config';
	} else if (hasUnderscoreBelowContentDirectoryPath(fileUrl, paths.contentDir)) {
		return 'ignored';
	} else if (isParentDirectory(dotAstroDir, fileUrl)) {
		return 'ignored';
	} else if (contentFileExts.includes(ext)) {
		return 'content';
	} else if (dataFileExts.includes(ext)) {
		return 'data';
	} else {
		return 'ignored';
	}
}

Subdomains

Frequently Asked Questions

What does getEntryType() do?
getEntryType() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is getEntryType() defined?
getEntryType() is defined in packages/astro/src/content/utils.ts at line 396.
What does getEntryType() call?
getEntryType() calls 2 function(s): hasUnderscoreBelowContentDirectoryPath, isParentDirectory.

Analyze Your Own Codebase

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

Try Supermodel Free