Get other data of other languages in the same request

default discord avatar
wiesson
2 months ago
2

My page has three languages and I'd like to achieve two tasks:



1. Add the canonical url of the other languages.


2. If the user switches the language, use the correct slug to switch to the "same page" in the desired language (if that page is available)



The 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.



Question: Is there a simpler method so that I don't have so many queries (at least 2-3 per page and language)?



Posted this question here as well:

https://github.com/payloadcms/payload/discussions/2386
  • default discord avatar
    Tinouti
    2 months ago

    Responded on Github! 🙌 ✅

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.