Browse Source

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.
George Cushen 4 years ago
parent
commit
5d827c258a

+ 0 - 5
wowchemy/config.toml

@@ -1,5 +0,0 @@
-[module]
-  [module.hugoVersion]
-    # This version of Wowchemy is compatible with the following Hugo versions:
-    min = "0.73.0"
-    extended = true

+ 15 - 0
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

+ 1 - 1
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": [{

+ 3 - 3
wowchemy/layouts/partials/site_head.html

@@ -80,9 +80,9 @@
     {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }}
     {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (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) }}
   <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
   {{ end }}
 

+ 2 - 2
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]