[[input.files]]
path = "pages/about_fr.html"
url = "/pages/about_fr.html"
[[input.files]]
path = "pages/about_fr.html"
url = "/fr/pages/about_fr.html"
I18N_SUBSITES = {
"fr": {
"SITENAME": "Mon beau site",
"SEARCH_I18_SUBSITE": "fr"
}
}
--- ./search.py.bak 2023-02-20 17:00:10.379008769 +0100
+++ ./search.py 2023-02-20 17:19:26.119005800 +0100
@@ -30,6 +30,7 @@
self.tpages = settings.get("TEMPLATE_PAGES")
self.search_mode = settings.get("SEARCH_MODE", "output")
self.html_selector = settings.get("SEARCH_HTML_SELECTOR", "main")
+ self.i18_subsite = settings.get("SEARCH_I18_SUBSITE", None)
def build_search_index(self, search_settings_path):
if not which("stork"):
@@ -62,6 +63,7 @@
pages += article.translations
input_files = ""
+ url_i18_prefix = self.i18_subsite + "/" if self.i18_subsite is not None else ""
# Generate list of articles and pages to index
for page in pages:
@@ -72,7 +74,7 @@
input_file = f"""
[[input.files]]
path = "{page_to_index}"
- url = "/{page.url}"
+ url = "/{url_i18_prefix}{page.url}"
title = {dumps(striptags(page.title))}
"""
input_files = "".join([input_files, input_file])
@@ -86,7 +88,7 @@
input_file = f"""
[[input.files]]
path = "{tpage_to_index}"
- url = "{self.tpages[tpage]}"
+ url = "{url_i18_prefix}{self.tpages[tpage]}"
title = ""
"""
input_files = "".join([input_files, input_file])
When using
i18_multisiteplugin the generation ofsearch.tomluses wrong URLs.For example
should be
To solve:
The patch for
search.py: