getContentEntryIdAndSlug() — astro Function Reference
Architecture documentation for the getContentEntryIdAndSlug() function in utils.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD f61711fc_04d4_ab3a_9fb1_968dd83addc6["getContentEntryIdAndSlug()"] 7a09e708_c090_71c0_8138_7343699b1865["utils.ts"] f61711fc_04d4_ab3a_9fb1_968dd83addc6 -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865 37024835_7752_ff66_8c2b_7bd53013a0a9["getRelativeEntryPath()"] f61711fc_04d4_ab3a_9fb1_968dd83addc6 -->|calls| 37024835_7752_ff66_8c2b_7bd53013a0a9 style f61711fc_04d4_ab3a_9fb1_968dd83addc6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/content/utils.ts lines 359–383
export function getContentEntryIdAndSlug({
entry,
contentDir,
collection,
}: Pick<ContentPaths, 'contentDir'> & { entry: URL; collection: string }): {
id: string;
slug: string;
} {
const relativePath = getRelativeEntryPath(entry, collection, contentDir);
const withoutFileExt = relativePath.replace(new RegExp(path.extname(relativePath) + '$'), '');
const rawSlugSegments = withoutFileExt.split(path.sep);
const slug = rawSlugSegments
// Slugify each route segment to handle capitalization and spaces.
// Note: using `slug` instead of `new Slugger()` means no slug deduping.
.map((segment) => githubSlug(segment))
.join('/')
.replace(/\/index$/, '');
const res = {
id: normalizePath(relativePath),
slug,
};
return res;
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does getContentEntryIdAndSlug() do?
getContentEntryIdAndSlug() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is getContentEntryIdAndSlug() defined?
getContentEntryIdAndSlug() is defined in packages/astro/src/content/utils.ts at line 359.
What does getContentEntryIdAndSlug() call?
getContentEntryIdAndSlug() calls 1 function(s): getRelativeEntryPath.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free