Search feature for multilingual site

I created a hugo theme using tailwindcss and provided a search function. I use a customized search layout to generate search pages and JSON data for normal pages.
But I have some problems when dealing with i18n:

  • only the default language is indexed
  • the search site is generated only for the default language (translations remain unused)

Detailed issue description can be found here

The original search feature was commit at

The demo site is

Any one have any ideas to fix this? Thanks.

.Site.RegularPages represents current language site pages, to index all site’s pages, you could do it with .Site.Sites.

{{ range .Site.Sites }}
  {{- $pages := where .RegularPages "Params.hidden" "!=" true -}}
  {{/* ... */}}
{{ end }}

See also

1 Like

How about the translation of layout page? Can I use some slug path for multilingual search result pages?

Finally I used a tricky way: add multilangual index.{lang}.md for search layout. Seems to work (maybe there is better solution).
Check this commit if anyone interested: