feat: display more specific warning if theme variation doesn't exist (#2843)

Based on the suggestion at https://discord.com/channels/722225264733716590/1024935456313450506/1025050134083543152
This commit is contained in:
Anirban Basu authored and GitHub committed 2022-10-02 18:51:29 +01:00
1 parent b2e1006155
commit 82a4452e6b
1 file changed
+2 -2
@@ -5,12 +5,12 @@
{{- $theme_night_index := (site.Params.appearance.theme_night | lower | replaceRE "\\s" "_") | default "minimal" -}}
{{- if not (index (index site.Data.themes $theme_day_index) "light") -}}
{{- warnf "Theme `%s` not found at `data/themes/%s.toml`" site.Params.appearance.theme_day $theme_day_index -}}
{{- warnf "In `params.yaml`, you requested `theme_day: %s` but there is not a `light` style in `data/themes/%s.toml`. Falling back to default light style." site.Params.appearance.theme_day $theme_day_index -}}
{{- $theme_day_index = "minimal" -}}
{{ end }}
{{- if not (index (index site.Data.themes $theme_night_index) "dark") -}}
{{- warnf "Theme `%s` not found at `data/themes/%s.toml`" site.Params.appearance.theme_night $theme_night_index -}}
{{- warnf "In `params.yaml`, you requested `theme_night: %s` but there is not a `dark` style in `data/themes/%s.toml`. Falling back to default dark style." site.Params.appearance.theme_night $theme_night_index -}}
{{- $theme_night_index = "minimal" -}}
{{ end }}