Install
Install
This repo serves two purposes:
- a Hugo module that provides reusable, namespaced shortcodes, and
- a self-documenting demo site you can run locally to explore examples.
Option A: Hugo Module (recommended)
- Initialize Hugo modules in your site (one-time setup):
| |
- Add the module to your site’s
hugo.toml. NOTE the path here has/moduleappended:
| |
- Fetch dependencies:
| |
⚠️ SCSS build requirement (Dart Sass)
This module compiles SCSS using Dart Sass (via Hugo Pipes). You must have the
sassbinary available on your system and in yourPATH.macOS (Homebrew):
1brew install sass/sass/sassLinux:
1 2 3brew install sass/sass/sass # or sudo snap install dart-sassWindows:
1 2 3choco install sass # or scoop install sassYou can verify Hugo sees the transpiler by running:
1hugo env
- Add the optional DX head shim (recommended for sites that use the dx CSS/JS bundles):
Create this file in your site:
layouts/partials/extend-head.html
With the following contents:
| |
If you already have a theme-provided
extend-head.html, keep it and add the snippet above to it.
You can now use the shortcodes in your content:
| |
Updating the module
Hugo modules are versioned and cached. When a new release of this module is published, existing sites will not automatically pick it up.
To update this module only to the latest version:
| |
To update all Hugo modules used by your site:
| |
If you prefer strict version pinning, you can lock to a specific release in your hugo.toml:
| |
In that case, updating means changing the version string explicitly.
Option B: Git submodule
If you don’t want to use Hugo modules, you can add this repo as a git submodule:
| |
From there you can either:
- copy the required
layouts/andassets/into your site, or - configure Hugo module mounts manually (more advanced).
Option C: Copy/paste (quick but manual)
If you only need a single shortcode (for example dx/photo):
- copy
layouts/shortcodes/dx/photo.gohtml - copy any required helpers under
layouts/partials/dx/ - copy required assets (CSS/JS referenced by the shortcode)
This works, but you’ll need to manually track updates.
Running the docs site locally
This repository is itself a runnable Hugo site. To explore the examples:
| |
This is the easiest way to understand how the shortcodes behave before integrating them into another project.
Getting Started for Contributors
If you plan to hack on the shortcodes (SCSS/CSS, JS, templates), it helps to run the docs site in a way that:
- binds to all interfaces (so you can hit it from your phone/tablet on the same network), and
- sets
baseURLcorrectly for the current machine.
Use the Makefile target
If you have the repo checked out locally, the easiest way is:
| |
This repo’s server target discovers your current LAN IP and runs Hugo like:
| |
One-off baseURL override
If you just want to run locally (without the Makefile), you can override the configured baseURL at runtime:
| |
This does not change your committed config and keeps GitHub Pages URLs intact.