From 5d827c258a26b8f44e283b600aa087bbd29b76c9 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Mon, 26 Oct 2020 22:32:20 +0000 Subject: [PATCH] feat: add more defaults to Wowchemy's config.toml Also, disable HighlightJS and Netlify Identity by default to optimize performance. Hugo restricts a module's own config file to only defining params, menu, outputformats, and mediatypes: https://gohugo.io/hugo-modules/theme-components/ . Lets define outputformats, and mediatypes directly in the module so there's one less thing for a user to add to their site's config file. --- wowchemy/config.toml | 5 ----- wowchemy/config.yaml | 15 +++++++++++++++ wowchemy/layouts/index.webmanifest | 2 +- wowchemy/layouts/partials/site_head.html | 6 +++--- wowchemy/test/config.yaml | 4 ++-- 5 files changed, 21 insertions(+), 11 deletions(-) delete mode 100644 wowchemy/config.toml create mode 100644 wowchemy/config.yaml diff --git a/wowchemy/config.toml b/wowchemy/config.toml deleted file mode 100644 index e8ce1682..00000000 --- a/wowchemy/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -[module] - [module.hugoVersion] - # This version of Wowchemy is compatible with the following Hugo versions: - min = "0.73.0" - extended = true diff --git a/wowchemy/config.yaml b/wowchemy/config.yaml new file mode 100644 index 00000000..3cfe1302 --- /dev/null +++ b/wowchemy/config.yaml @@ -0,0 +1,15 @@ +mediaTypes: + application/manifest+json: + suffixes: + - webmanifest +outputFormats: + WebAppManifest: + mediaType: application/manifest+json + rel: manifest +module: + hugoVersion: + min: '0.73.0' + extended: true +params: + theme: minimal + font: native diff --git a/wowchemy/layouts/index.webmanifest b/wowchemy/layouts/index.webmanifest index 6dbff198..3a0cd1ac 100644 --- a/wowchemy/layouts/index.webmanifest +++ b/wowchemy/layouts/index.webmanifest @@ -2,7 +2,7 @@ { "name": "{{site.Title}}", "short_name": "{{site.Title}}", - "lang": "{{site.LanguageCode}}", + "lang": "{{ site.LanguageCode | default "en-us" }}", "theme_color": "{{ $scr.Get "primary" }}", "background_color": "{{ $scr.Get "primary" }}", "icons": [{ diff --git a/wowchemy/layouts/partials/site_head.html b/wowchemy/layouts/partials/site_head.html index 0be4024e..c27351a2 100644 --- a/wowchemy/layouts/partials/site_head.html +++ b/wowchemy/layouts/partials/site_head.html @@ -80,9 +80,9 @@ {{ printf "" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }} {{ printf "" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }} - {{/* Default to enabling highlighting, but allow the user to override it in .Params or site.Params. + {{/* Default to disabling highlighting, but allow the user to override it in .Params or site.Params. Use $scr to store "highlight_enabled", so that we can read it again in footer.html. */}} - {{ $scr.Set "highlight_enabled" true }} + {{ $scr.Set "highlight_enabled" false }} {{ if isset .Params "highlight" }} {{ $scr.Set "highlight_enabled" .Params.highlight }} {{ else if isset site.Params "highlight" }} @@ -160,7 +160,7 @@ {{ partial "marketing/google_tag_manager" . }} {{/* Netlify Identity integration. */}} - {{ if .IsHome | and (site.Params.cms.netlify_cms | default true) }} + {{ if .IsHome | and (site.Params.cms.netlify_cms | default false) }} {{ end }} diff --git a/wowchemy/test/config.yaml b/wowchemy/test/config.yaml index 9ab89c9f..79a5f275 100644 --- a/wowchemy/test/config.yaml +++ b/wowchemy/test/config.yaml @@ -2,5 +2,5 @@ title: Wowchemy Test module: imports: - path: github.com/wowchemy/wowchemy-hugo-modules/wowchemy -params: - theme: minimal +outputs: + home: [HTML, RSS, JSON, WebAppManifest]