Replies: 2 comments 2 replies
-
You can pass From the docs:
|
Beta Was this translation helpful? Give feedback.
1 reply
-
A bit late, but i did this: export const slugBeforeRead: BeforeReadHook = async ({ doc, req }) => {
return {
...doc,
slugs: doc.slug,
};
}; export const BlogCategories: CollectionConfig = {
slug: "blog-categories",
access: {
read: () => true,
},
labels: {
plural: "Blog categories",
},
hooks: {
beforeRead: [slugBeforeRead],
}, So now in API you also have "slugs" field contain all languages with 1 request only, if you use locale=* you still have to fetch for your language |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My page has three languages and I'd like to achieve two tasks:
hreflang
url of the other languages for SEOThe problem is that each page has a different slug so I have to query the first page by slug, then use the id to query the others.
In the above mentioned example, I need two requests to obtain DE/FR (from EN perspective). The same applies to subpages, of that page, because I need the other slug of the entry itself and their parent.
Question: Is there a simpler method so that I don't have so many queries (at least 2-3 per page and language)?
Best solution to me would if each document would return their "siblings" automatically. Could this be achieved by a hook?
Beta Was this translation helpful? Give feedback.
All reactions