Get other language version urls via Heartcore GraphQL
Hi,
I am considering using GraphQL instead of the standard Heartcore content API to get heartcore content for my frontend.
I have noticed that the content API returns a _urls field for every item, which shows the item's URL in all of the languages, and that field seems to be missing in the GraphQL implementation.
Since I want to implement hreflang in my frontend, I need the urls of the language variants. How can I get this data, without using multiple queries (per locale) in GraphQL?
Hey Davy,
I really can´t add anything to your question, but I tried to only get those articles available in a certain language.
I managed that setting the header in API-Browser, but couldn´t find anything in the documentation about culture.
How do you actually set the culture in GraphQL fo Heartcore?
Compared to the _urls field in the content API, here you need to explicitly make a field per language url in your graphql query, but you don't often need to add languages to a setup so I can live with that.
Get other language version urls via Heartcore GraphQL
Hi,
I am considering using GraphQL instead of the standard Heartcore content API to get heartcore content for my frontend.
I have noticed that the content API returns a _urls field for every item, which shows the item's URL in all of the languages, and that field seems to be missing in the GraphQL implementation.
Since I want to implement hreflang in my frontend, I need the urls of the language variants. How can I get this data, without using multiple queries (per locale) in GraphQL?
Kind regards,
Hey Davy, I really can´t add anything to your question, but I tried to only get those articles available in a certain language. I managed that setting the header in API-Browser, but couldn´t find anything in the documentation about culture.
How do you actually set the culture in GraphQL fo Heartcore?
Best, Gerhard
Figured it out, after re-reading the documentation.
so this actually returns all nodes, but "null" for those where a german value is not available. Is there a shortcut to set this globally?
Hi Gerhard,
Try putting (culture: "de") on items. Like:
If that doesn't work, put it on allBasePage?
But still - my own question still stands: is there a GraphQL alternative to the _urls field that exists in the Content Delivery API?
Thanks, works if I put them here:
Found the answer to my own question: "how do I get other language version urls via Heartcore GraphQL?"
You can supply a culture parameter to the content.url field!
So to get the urls of the nodes in multiple languages you can do:
Compared to the _urls field in the content API, here you need to explicitly make a field per language url in your graphql query, but you don't often need to add languages to a setup so I can live with that.
is working on a reply...