diff --git a/hugo/README.md b/hugo/README.md index ec82fa4..178337b 100644 --- a/hugo/README.md +++ b/hugo/README.md @@ -1,5 +1,5 @@ --- -title: Hugo +title: Hugo (Standard & Extended Editions) homepage: https://github.com/gohugoio/hugo tagline: | Hugo: The world’s fastest framework for building websites. @@ -8,11 +8,45 @@ tagline: | To update or switch versions, run `webi hugo@stable` (or `@v0.87`, `@beta`, etc). +### Files + +These are the files / directories that are created and/or modified with this +install: + +```text +~/.config/envman/PATH.env +~/.local/opt/hugo/ +~/.local/bin/hugo +``` + ## Cheat Sheet > Hugo is one of the most popular open-source static site generators. It makes > building websites fun again. +Hugo is a simple and fast Jamstack / Static Site Generator (SSG) tool, which +comes in two flavors: + +**Hugo Standard Edition**: Fast, Safe, & Runs Almost Everywhere + +**Hugo Extended Edition**: Supports _libsass_ transpilation and _WebP_ encoding, +but mixed with unsafe C code and available for fewer OSes and CPU architectures + +### How to Pick & Switch Editions + +You'll need [Hugo Extended Edition](../hugo-extended/) for: + +- legacy `libsass` support - if you use templates that require it \ + (["dartsass"](../sass/), also known as just "sass", is supported in both) +- **WebP** encoding + +Use `webi hugo-extended` and `webi hugo` to switch between editions. + +Use `hugo env` to determine which edition you're running (Extended Edition +references _libsass_ and _WebP_ in the output). + +See [hugo-extended](../hugo-extended/) tips specific to Hugo Extended Edition. + ### Create a new site ```sh diff --git a/hugo/install.sh b/hugo/install.sh index 434fa67..fa0cd70 100644 --- a/hugo/install.sh +++ b/hugo/install.sh @@ -1,14 +1,27 @@ #!/bin/sh -set -e -set -u -pkg_cmd_name="hugo" -WEBI_SINGLE=true +# shellcheck disable=SC2034 +# "'pkg_cmd_name' appears unused. Verify it or export it." + +__init_hugo() { + set -e + set -u + + ################ + # Install hugo # + ################ + + pkg_cmd_name="hugo" + WEBI_SINGLE=true + + pkg_get_current_version() { + # 'hugo version' has output in this format: + # hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d darwin/arm64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio + # This trims it down to just the version number: + # 0.118.2 + hugo version 2> /dev/null | head -n 1 | cut -d' ' -f2 | cut -d '-' -f1 | sed 's:^v::' + } -pkg_get_current_version() { - # 'hugo version' has output in this format: - # Hugo Static Site Generator v0.72.0-8A7EF3CF darwin/amd64 BuildDate: 2020-05-31T12:07:44Z - # This trims it down to just the version number: - # 0.72.0 - hugo version 2> /dev/null | head -n 1 | cut -d' ' -f5 | cut -d '-' -f1 | sed 's:^v::' } + +__init_hugo diff --git a/hugo/releases.js b/hugo/releases.js index 610129b..9b3aef5 100644 --- a/hugo/releases.js +++ b/hugo/releases.js @@ -4,14 +4,27 @@ var github = require('../_common/github.js'); var owner = 'gohugoio'; var repo = 'hugo'; -module.exports = function (request) { - return github(request, owner, repo).then(function (all) { +module.exports = async function (request) { + let all = await github(request, owner, repo); + + all.releases = all.releases.filter(function (rel) { + let isExtended = rel.name.includes('_extended_'); + if (isExtended) { + return false; + } + // remove checksums and .deb - all.releases = all.releases.filter(function (rel) { - return !/(\.txt)|(\.deb)$/i.test(rel.name); - }); - return all; + for (let ignorableExt of ['.txt', '.deb']) { + let isIgnorable = rel.name.endsWith(ignorableExt); + if (isIgnorable) { + return false; + } + } + + return true; }); + + return all; }; if (module === require.main) {