diff --git a/config/_default/config.yaml b/config/_default/config.yaml index 8f52f13a..3926ba1c 100644 --- a/config/_default/config.yaml +++ b/config/_default/config.yaml @@ -7,6 +7,12 @@ disableHugoGeneratorInject: true enableEmoji: true timeZone: Europe/Paris theme: ["2026"] +security: + funcs: + getenv: + - "^HUGO_" + - "^CI$" + - "^MEILI_SEARCH_API_KEY$" params: lists: layout: spotlight diff --git a/layouts/recherche/single.html b/layouts/recherche/single.html index 32753928..6a9f6d23 100644 --- a/layouts/recherche/single.html +++ b/layouts/recherche/single.html @@ -1,6 +1,10 @@ {{ define "main" }} {{- $search := .Site.Params.search -}} {{- $meili := $search.meilisearch -}} +{{- $apiKey := getenv "MEILI_SEARCH_API_KEY" -}} +{{- if eq $apiKey "" -}} + {{- errorf "MEILI_SEARCH_API_KEY is required to render the search page" -}} +{{- end -}}
{{ partialCached "header-brand.html" .Site .Site.Title (.Site.Params.logo | default "logo-large.png") }}

{{ .Title }}

@@ -9,7 +13,7 @@ class="search-page" data-search-endpoint="{{ $meili.endpoint }}" data-search-index="{{ $meili.indexUid }}" - data-search-api-key="{{ $meili.apiKey }}" + data-search-api-key="{{ $apiKey }}" data-search-limit="{{ $meili.hitsPerPage }}" data-search-param="{{ $search.param }}" >