You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When collectionPathMode='root', the contentPath option must be specified and point to the content collection that should be treated as the site root in order to transform a content collection to the site root.
For example, given the following directory structure & markdown file references:
Click on Blog Item 1 - Results in 404 because the transformed path is /blog/item-1.md
Add contentPath: 'src/content/blog' to the plugin options in astro.config.mjs
Repeat step 1 & 2
contentPath was added in v0.5.0 to support treating a content collection as the site root (see #2) so that the collection name was not prefixed to the transformed path. However, the contentPath option had some shortcomings:
It provided the ability for the user to specify a content directory which Astro does not allow, it is always ./content relative to the srcDir option. Beyond that, it creates unnecessary confusion because the contentPath points to a specific content collection whereas in Astro lingo, the content path should contain subdirectories of content collections.
While multiple content collections would still work even with contentPath pointing to a specific content collection directory (because of relative paths), the option was applied to all content collections when it was intended to only identify one content collection as the site root.
When collectionPathMode was added in #19, it resolved the issues in #18, however it did not address the other two issues. With collectionPathMode in-place, there is no need for the contentPath to be specified and it should be removed. In its place, a srcDir option should be added to align with Astro's srcDir option.
The text was updated successfully, but these errors were encountered:
When
collectionPathMode='root'
, thecontentPath
option must be specified and point to the content collection that should be treated as thesite root
in order to transform a content collection to the site root.For example, given the following directory structure & markdown file references:
src/content/blog/item-1.md
src/content/newsletter/item-1.md
In order to have the
blog
content collection treated assite root
, the following configuration is required:Repro: https://stackblitz.com/edit/withastro-astro-npyzr7
Steps to reproduce:
Blog Item 1
- Results in 404 because the transformed path is/blog/item-1.md
contentPath: 'src/content/blog'
to the plugin options in astro.config.mjscontentPath
was added in v0.5.0 to support treating a content collection as the site root (see #2) so that the collection name was not prefixed to the transformed path. However, thecontentPath
option had some shortcomings:contentPath
is the same as thecollectionPath
, some transformed paths are incorrect #18 and PR fix: handle collections in root of site (#18) #19).content directory
which Astro does not allow, it is always./content
relative to the srcDir option. Beyond that, it creates unnecessary confusion because thecontentPath
points to a specific content collection whereas in Astro lingo, the content path should contain subdirectories of content collections.contentPath
pointing to a specific content collection directory (because of relative paths), the option was applied to all content collections when it was intended to only identify one content collection as thesite root
.When
collectionPathMode
was added in #19, it resolved the issues in #18, however it did not address the other two issues. WithcollectionPathMode
in-place, there is no need for thecontentPath
to be specified and it should be removed. In its place, asrcDir
option should be added to align with Astro's srcDir option.The text was updated successfully, but these errors were encountered: