ref(hugo): update for latest standard and extended editions

This commit is contained in:
AJ ONeal
2023-09-16 23:25:11 +00:00
parent cf1c486616
commit b476074f04
3 changed files with 77 additions and 17 deletions
+35 -1
View File
@@ -1,5 +1,5 @@
---
title: Hugo
title: Hugo (Standard & Extended Editions)
homepage: https://github.com/gohugoio/hugo
tagline: |
Hugo: The worlds 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
+23 -10
View File
@@ -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
+19 -6
View File
@@ -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) {