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
In a situation where a custom collection in a directory of src/content/docs is mapped to something other than the physical content collection directory name, the wrong url is generated.
It is mentioned in the assumptions located at the top of the README that this scenario is not covered, however I think it would be fairly simple to, at a minimum, handle collection name mappings (path -> directory). Beyond that, for things like handling other path segments, it gets way more complex without internal Astro info and/or metadata in options.
For example, in the following directory structure, the [...slug].astro is written to use the content collection docs in the directory docs, however the path to the page (virtualized essentially) is my-docs/test and not docs/test.
Leverage metadata in the link in the markdown (similar to the way classes, titles, etc. work)
[Some Text](some-url title){ .class-1 }
I think Option 1 makes the most sense as Option 2 is highly dependent on markdown processer, is very error prone and would require every link to have the metadata rather than just a single place to do the mapping as would be the case in option 1.
Thoughts? Other ideas on how to solution and if you think this scenario is worth solving for?
The text was updated successfully, but these errors were encountered:
techfg
changed the title
bug: When using a custom collection name path, wrong url is generated
feat: When using a custom collection name path, wrong url is generated
Apr 10, 2024
techfg
changed the title
feat: When using a custom collection name path, wrong url is generated
feat: support mapping a content collection directory name to a site page path
Apr 10, 2024
In a situation where a custom collection in a directory of
src/content/docs
is mapped to something other than the physical content collection directory name, the wrong url is generated.It is mentioned in the assumptions located at the top of the README that this scenario is not covered, however I think it would be fairly simple to, at a minimum, handle collection name mappings (path -> directory). Beyond that, for things like handling other path segments, it gets way more complex without internal Astro info and/or metadata in options.
For example, in the following directory structure, the
[...slug].astro
is written to use the content collectiondocs
in the directorydocs
, however the path to the page (virtualized essentially) ismy-docs/test
and notdocs/test
.Repro: https://stackblitz.com/edit/github-pdzrjo-gg4trc
Steps to reproduce:
Collection Root
orCollection Subdir
sectionsExpected Result:
The links generated should be
my-docs/[slug]
and navigate successfullyActual Result:
The links generated are
docs/[slug]
and 404Debug
pagemy-docs/[slug]
We do not have internal information so there is no current way to detect this situation. Ideas on ways to solve for this situation:
collectionNames
which is a key/value pair that makes a physical directory to the collection name. For example, using the above:I think Option 1 makes the most sense as Option 2 is highly dependent on markdown processer, is very error prone and would require every link to have the metadata rather than just a single place to do the mapping as would be the case in option 1.
Thoughts? Other ideas on how to solution and if you think this scenario is worth solving for?
The text was updated successfully, but these errors were encountered: