getContentPaths() — astro Function Reference
Architecture documentation for the getContentPaths() function in utils.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 38ea7ddd_a3ec_4810_fa09_65e574335368["getContentPaths()"] 7a09e708_c090_71c0_8138_7343699b1865["utils.ts"] 38ea7ddd_a3ec_4810_fa09_65e574335368 -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865 6c793dbe_77b3_414d_aedb_6d44b431caa5["loadContentConfig()"] 6c793dbe_77b3_414d_aedb_6d44b431caa5 -->|calls| 38ea7ddd_a3ec_4810_fa09_65e574335368 214ad4a8_dd56_6d8d_038c_f9b69388b527["searchConfig()"] 38ea7ddd_a3ec_4810_fa09_65e574335368 -->|calls| 214ad4a8_dd56_6d8d_038c_f9b69388b527 966b7a30_79ce_3d35_f299_f8c16ffba798["searchLegacyConfig()"] 38ea7ddd_a3ec_4810_fa09_65e574335368 -->|calls| 966b7a30_79ce_3d35_f299_f8c16ffba798 4e37ff5a_e360_c343_3402_f5782af3bcf0["getContentPathsWithConfig()"] 38ea7ddd_a3ec_4810_fa09_65e574335368 -->|calls| 4e37ff5a_e360_c343_3402_f5782af3bcf0 963a7d31_acfc_40bb_1769_fa4a5a1b6c4f["searchLiveConfig()"] 38ea7ddd_a3ec_4810_fa09_65e574335368 -->|calls| 963a7d31_acfc_40bb_1769_fa4a5a1b6c4f style 38ea7ddd_a3ec_4810_fa09_65e574335368 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/content/utils.ts lines 715–751
export function getContentPaths(
{ srcDir, root }: Pick<AstroConfig, 'root' | 'srcDir'>,
fs: typeof fsMod = fsMod,
legacyCollectionsBackwardsCompat = false,
): ContentPaths {
const pkgBase = new URL('../../', import.meta.url);
const configStats = searchConfig(fs, srcDir);
if (!configStats.exists) {
const legacyConfigStats = searchLegacyConfig(fs, srcDir);
if (legacyConfigStats.exists) {
if (!legacyCollectionsBackwardsCompat) {
const relativePath = path.relative(
fileURLToPath(root),
fileURLToPath(legacyConfigStats.url),
);
throw new AstroError({
...AstroErrorData.LegacyContentConfigError,
message: AstroErrorData.LegacyContentConfigError.message(relativePath),
});
}
// Use legacy config path when backwards compat is enabled
return getContentPathsWithConfig(root, srcDir, pkgBase, legacyConfigStats, fs);
}
}
const liveConfigStats = searchLiveConfig(fs, srcDir);
return {
root: new URL('./', root),
contentDir: new URL('./content/', srcDir),
assetsDir: new URL('./assets/', srcDir),
typesTemplate: new URL('templates/content/types.d.ts', pkgBase),
virtualModTemplate: new URL('templates/content/module.mjs', pkgBase),
config: configStats,
liveConfig: liveConfigStats,
};
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getContentPaths() do?
getContentPaths() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is getContentPaths() defined?
getContentPaths() is defined in packages/astro/src/content/utils.ts at line 715.
What does getContentPaths() call?
getContentPaths() calls 4 function(s): getContentPathsWithConfig, searchConfig, searchLegacyConfig, searchLiveConfig.
What calls getContentPaths()?
getContentPaths() is called by 1 function(s): loadContentConfig.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free