Replies: 2 comments 2 replies
-
Thanks for starting a discussion @y-nk! Happy to give a little background on why this feature was cut from our initial 2.0 release. For those unaware, we proposed a collection-level First, allowing access to parsed The second issue runs deeper: We're unsure if All of this said, I think there is a middle ground to support the use case proposed here. This isn't the first time we've seen the need for programmatic slug generation! |
Beta Was this translation helpful? Give feedback.
-
Cross-posting issue from @narduin here: withastro/astro#7133 . Agreed that permalinks-as-identifiers is problematic. Creating a new "permalink" concept separate from IDs, specifically for pages, is one option. |
Beta Was this translation helpful? Give feedback.
-
This proposal is already pretty well documented (as long as a proposal solution) at withastro/astro#6307
Basically, i do think it's a nice feature we had, and generally to have: to be able to format the slugs before serving/building, otherwise said: have a space to be able to map urls to file system programmatically.
I'm trying to write a collection of small snippets of code, i've probably around 200 already. I'd like to keep lean urls such as "example.com/this-cool-snippet" but as the collection grows, the file system organisation becomes quite messy messy. so i thought to add a "001-" prefix to them; but then the url contains that prefix, which i dont want.
One could argue "you could write the slug directly in the frontmatter data of each file", but it doesn't scale well. having a programmatic entry point is, i think, high value.
I think it's a pretty valid usecass to wish to You rearrange filesystem structure to have a 000- prefix, while wishing not to have this spilling in urls (for many reasons, from cosmetic reasons to seo). We could also benefit from this if one wanted to have a collection organized as "yyyy-mm-dd-slug" files while served as a totally different url (with slashes, like wordpress, without having to create a commiting/difficult-to-maintain nested file structure)
Of course this feature would remain optional and non-breaking and the default would still be a 1-1 mapping, it wouldn't affect users not willing to use it.
Beta Was this translation helpful? Give feedback.
All reactions