Hi — first of all, thanks a ton for all the effort.
It's a pretty amazing module!
I've stumbled upon the following issue and would love to hear your thoughts.
Assumed there's a structure like:
content/
series-a/
intro.md
subpost-a-1.md
subpost-a-2.md
series-b/
intro.md
subpost-b-1.md
subpost-b-2.md
In this case, both intro.md files would have the same slug.
That's usually not an issue at all since it's up to the developers when to use path or slug.
But how to proceed when trying to fetch the surrounding posts?
That feature uses the slugs property which isn't unique and thus the results are not really predictable. Is there a "proper" workaround, would you consider it a bug or should the developers take care of unique file names? 😊
Cheers,
Felix
Hey @felixheck,
When using surround, you can specify a parent directory, so you could do something like:
const [prev, next] = await this.$content('series-a')
.surround('intro')
.fetch()
However, if you want to browse across all your files using deep-fetching for example, in my opinion you should take care of unique file names yes.
Merci beaucoup!
I just wrote my own surround function which uses paths instead of slugs.
Not ideal but it's just needed in one place, so it's fine 😊
Have a nice weekend.
Most helpful comment
Hey @felixheck,
When using
surround, you can specify a parent directory, so you could do something like:However, if you want to browse across all your files using deep-fetching for example, in my opinion you should take care of unique file names yes.