navigation
navigation copied to clipboard
Graphql | Conflict between `site` and `language` parameters
Describe the bug
I have an issue where if I query a navigation via Graphql with a site and language parameters, the language param seems to make the site param useless.
Here are my sites :
And in the multisite version :
Here is my test query :
query getNav {
mainNavigation: navigationNodes(
site: "mainSiteFr"
nav: "navMain"
level: 1
language: "en"
) {
url
title
classes
element {
slug
}
}
}
And the result contains only the navigation Nodes of the mainSiteEn website.
In that context, I expect and empty Result because the site mainSiteFr does not have the en language.
MultiSite version:
query getMainNav {
mainNavigation: navigationNodes(site: "frSite1", nav: "navMain", level: 1, language: "fr") {
url
title
classes
element {
slug
}
}
}
In a multisite context, this is even worse because the result comes from a different site in the same language.
Steps to reproduce (reproduce from screenshot above)
- Create 2 sites with different languages
- Create a navigation with some nodes on both sites
- Use the above gql query
Steps to reproduce Multisite (reproduce from screenshot above)
- Create 2 groups of 2 sites with same languages
- Create a navigation with some nodes on both sites
- Use the above gql query
Craft CMS version
5.6.11
Plugin version
3.0.6
Multi-site?
Both yes and no
Additional context
I have the headlessMode active in craft general.php, not sure if it matters
Can I ask is there a reason to include both the site and the language? Seeing as though site's need to be unique, and navigation nodes are enabled based on a site, not a language, you use that?
Hey, sorry for the delay.
In my front context I have the siteHandles (that dont always contains the language) of all current site or subsite of the web query and in the gql query I send the multiple siteHandles like site: ["frSite1", "enSite1"] with the language parameter to get the proper navigation nodes.