getEntryCollectionName() — astro Function Reference
Architecture documentation for the getEntryCollectionName() function in utils.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD f76a590d_0935_b33d_2e35_9357b26a3d04["getEntryCollectionName()"] 7a09e708_c090_71c0_8138_7343699b1865["utils.ts"] f76a590d_0935_b33d_2e35_9357b26a3d04 -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865 style f76a590d_0935_b33d_2e35_9357b26a3d04 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/content/utils.ts lines 328–343
export function getEntryCollectionName({
contentDir,
entry,
}: Pick<ContentPaths, 'contentDir'> & { entry: string | URL }) {
const entryPath = typeof entry === 'string' ? entry : fileURLToPath(entry);
const rawRelativePath = path.relative(fileURLToPath(contentDir), entryPath);
const collectionName = path.dirname(rawRelativePath).split(path.sep)[0];
const isOutsideCollection =
!collectionName || collectionName === '' || collectionName === '..' || collectionName === '.';
if (isOutsideCollection) {
return undefined;
}
return collectionName;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does getEntryCollectionName() do?
getEntryCollectionName() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is getEntryCollectionName() defined?
getEntryCollectionName() is defined in packages/astro/src/content/utils.ts at line 328.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free