#Get post by slug without info about collection
10 messages · Page 1 of 1 (latest)
https://docs.astro.build/en/reference/api-reference/#getentrybyslug
see this for a complete project example https://github.com/MicroWebStacks/astro-examples#12_content-collections
I need to get the page without info about the collection, that is the problem
did you see the link I posted ? getEntryBySlug()
I think you need to explain a bit more otherwise, maybe post a non functional example of how you want it with expected result.
in this case you'd need to loop over the possible collections and try getEntryBySlug on each to find the first one with a post including the matching slug
but why would someone mix slug of multiple collections on the same url ? when you get the slug you usually know the collection, otherwise something's fishy.
not sure what the OP is doing. maybe a top-level [slug].astro file. but yeah, iterating over will be the only way to do it
true. that way also you mix e.g. authors and books on the same path/slug (not much sense), you also have to ensure the slug is unique across all collections. Not a recommended design.
Hi, thanks for the answer. I want to create a tag page where for the tag i get a list of posts for every content type in the website.
for that Otterlord solution of looping through all collections and check result of getEntryBySlug() should work for you right ? did you try that ?