No longer load Umbrella JS by default sine alla theme JS is vanilla. Updated jQuery to latest version. Updated README.

This commit is contained in:
Fredrik Jonsson 2022-12-21 13:56:57 +01:00
commit 0581ac810f
4 changed files with 22 additions and 8 deletions

View file

@ -61,6 +61,7 @@ Take a look at the [Zen demo site](https://zen-demo.xdeb.org/) ([GitHub](https:/
## Features
* A mobile menu
* AlpineJS 3
* Analytics with Matamo (Piwik)
* Cookie consent
* Commands for linting of css and js
@ -205,6 +206,7 @@ theme: "zen"
languageCode: "en-GB" # Set your language code (only needed for none multilingual sites).
params:
alpine: # Add AlpineJS, default false.
cookieConsent: true # Show cookie consent form, default false.
contact: "info@example.org"
copyright: "This site is licensed under a
@ -218,7 +220,7 @@ params:
icon: "" # Relative path to icon in json feed and JSON-LD, no leading slash.
image: "" # Relative path to site image in JSON-LD, no leading slash.
imageMaxWidth: "" # Max width for images added via figure shortcode.
jquery: true # Add jQuery
jquery: true # Add jQuery, default false.
languageDir: "" # Set ltr or rtl, defaults to ltr.
logo: false # Turn off the logo.
logoPath: # Relative path to site logo, defaults to "images/logo.png", no leading slash.
@ -235,13 +237,13 @@ params:
plausibleTrackerURL: "" # Plausible url, schemaless and no slash on end. Optional, defaults to "plausible.io/…"
poweredby: true # Show powered by hugo in footer
privacyPolicyUrl: "" # If set will add link to cookie consent form.
realfavicongenerator: # If full set of favicons, site manifest etc. exists, default false.
relatedposts: true # Show related posts under a "See also" section, default false.
searchLimit: 20 # Max number of search hits, default 20.
sidebar: true # Show a sidebar to the right, default false.
submitted: true # Show author and date information for a post.
themeColor: # Hex color value, used in meta tags, default "#ffffff".
umbrella: true # Add Umbrella JS, default false.
podcast:
title: # * Feed title, defaults to site title (iTunes).
@ -694,9 +696,9 @@ The **content** that should be wrapped. Some more content.
Includes tracking code for Matomo or Google in a way that supports Content security policy headers. Read more in my blog post [Content security policy headers when using Matomo or Google analytics](https://xdeb.org/post/2020/01/14/content-security-policy-headers-when-using-matomo-or-google-analytics/).
## Choose between using jQuery or Umbrella JS
## Choose between using AlpineJS, jQuery or Umbrella JS
[Umbrella JS](https://umbrellajs.com/) (a tiny jQuery replacement) is always added and it's used for all theme JavaScript. To add jQuery, set the related parameter to true in the configuration file or in the front matter of specific pages. No problem having both libraries loaded on the same page.
To add AlpineJS, jQuery or Umbrella JS, set the related parameter to true in the configuration file or in the front matter of specific pages. No problem having them loaded on the same page.
This is the way I construct my JavaScript files.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,39 +1,50 @@
{{ $early := resources.Get "js/script-early.js" | minify | fingerprint -}}
<script src="{{ $early.RelPermalink }}"></script>
{{ if $.Param "alpine" -}}
{{ $alpine := resources.Get "js/lib/alpine.min.js" | fingerprint -}}
<script defer src="{{ $alpine.RelPermalink }}"></script>
{{ end -}}
{{ if $.Param "jquery" -}}
{{ $jquery := resources.Get "js/lib/jquery.slim.min.js" | fingerprint -}}
<script defer src="{{ $jquery.RelPermalink }}"></script>
{{ end -}}
{{ if $.Param "umbrella" -}}
{{ $umbrella := resources.Get "js/lib/umbrella.min.js" | fingerprint -}}
<script defer src="{{ $umbrella.RelPermalink }}"></script>
{{ end -}}
{{ if $.Param "mobilemenu" -}}
{{ $mobilemenu := resources.Get "js/mobile.js" | minify | fingerprint -}}
<script defer src="{{ $mobilemenu.RelPermalink }}"></script>
{{ end -}}
{{ if $.Param "cookieconsent" -}}
{{ $cookieconsent := resources.Get "js/cookieconsent.js" | minify | fingerprint -}}
<script defer src="{{ $cookieconsent.RelPermalink }}"></script>
{{ end -}}
{{ if $.Param "lazyload" -}}
{{ $lozadmin := resources.Get "js/lib/lozad.min.js" | fingerprint -}}
<script defer src="{{ $lozadmin.RelPermalink }}"></script>
{{ $lozad := resources.Get "js/lozadinit.js" | fingerprint -}}
<script defer src="{{ $lozad.RelPermalink }}"></script>
{{ end -}}
{{ if $.Param "listsort" -}}
{{ $listmin := resources.Get "js/lib/list.min.js" | fingerprint -}}
<script defer src="{{ $listmin.RelPermalink }}"></script>
{{ $listsort := resources.Get "js/listsort.js" | fingerprint -}}
<script defer src="{{ $listsort.RelPermalink }}"></script>
{{ end -}}
{{ if .HasShortcode "contact" -}}
{{ $contact := resources.Get "js/contact.js" | minify | fingerprint -}}
<script defer src="{{ $contact.RelPermalink }}"></script>
{{ end -}}
{{ if .HasShortcode "search" -}}
{{ $flexsearch := resources.Get "js/lib/flexsearch.compact.js" | fingerprint -}}
<script defer src="{{ $flexsearch.RelPermalink }}"></script>
@ -41,5 +52,6 @@
{{ $search := resources.Get "js/search.js" | js.Build $search_opts | fingerprint -}}
<script defer src="{{ $search.RelPermalink }}"></script>
{{ end -}}
{{ $script := resources.Get "js/script.js" | minify | fingerprint -}}
<script defer src="{{ $script.RelPermalink }}"></script>