Environment
Problem
The following is in the Docsy search documentation: https://www.docsy.dev/docs/adding-content/search/ regarding Google Search:
Add your Google Custom Search Engine ID to the site params in hugo.toml/hugo.yaml/hugo.json. You can add different values per language if needed.
Based on this, we have:
contentDir = "content"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
[languages]
[languages.en]
[languages.en.params]
gcs_engine_id="abc123"
[languages.fr]
[languages.fr.params]
gcs_engine_id="zyx987"
So if you go to:
sample.site - enter a search, returns sample.site/search?q=blahdeblah
sample.site/fr - enter a search, returns sample.site/search?q=blahdeblah
In either case, the site it returning the default language as the search parameter. Using the defaultContentLanguageInSubdir = true option just breaks Google search entirely (as related in another ticket).
I've tried playing about with the /assets/js/search.js to tweak the var searchPage = '{{ "search/" | absURL }}?q=' + query; line with absLangURL, but that doesn't make it any happier.
Any recommendations or tips from people who have been through this and found a solution? My only guess is the layouts/_partials/search-input.html used will always default to the default language, but I'm not educated enough to see why.
Environment
hugo version): hugo v0.148.2+extendedProblem
The following is in the Docsy search documentation: https://www.docsy.dev/docs/adding-content/search/ regarding Google Search:
Based on this, we have:
So if you go to:
sample.site - enter a search, returns sample.site/search?q=blahdeblah
sample.site/fr - enter a search, returns sample.site/search?q=blahdeblah
In either case, the site it returning the default language as the search parameter. Using the
defaultContentLanguageInSubdir = trueoption just breaks Google search entirely (as related in another ticket).I've tried playing about with the
/assets/js/search.jsto tweak thevar searchPage = '{{ "search/" | absURL }}?q=' + query;line withabsLangURL, but that doesn't make it any happier.Any recommendations or tips from people who have been through this and found a solution? My only guess is the
layouts/_partials/search-input.htmlused will always default to the default language, but I'm not educated enough to see why.