A Hugo template that turns a content tree into a static CDN catalog:
every collection and asset gets a JSON descriptor alongside the HTML page,
plus a root manifest and a .well-known entry-point. Deployable to
GitHub Pages or Netlify with no extra service.
The template does not host large binaries itself — it's a catalog. Each
asset's href front-matter field points at where the bytes actually
live (R2, S3, CloudFront, the same Pages site, anywhere). It is emitted
as "url" in the JSON descriptors so consumers see a natural name.
| Path | Purpose |
|---|---|
/index.json |
Root catalog — list of collections, spec/version, links |
/<collection>/index.json |
Collection manifest — list of assets |
/<collection>/<asset>/index.json |
Per-asset descriptor (version, sha256, size, mime, url, tags…) |
/.well-known/cdn.json |
Stable entry-point pointing at /index.json |
/sitemap.xml, /index.xml |
Hugo-generated sitemap and RSS feed |
Consumers (public/private front- or back-ends) can hit
/.well-known/cdn.json once and crawl from there.
content/
_index.md # catalog metadata
releases/
_index.md # collection metadata
example-0.1.0/
index.md # asset front-matter + notes
(any bundled files…) # exposed as `resources` in JSON
hugo new --kind asset releases/my-asset-1.2.0/index.mdThen edit the front matter (version, href, mime, size, sha256,
license, tags).
hugo server
# http://localhost:1313/
# http://localhost:1313/index.json
# http://localhost:1313/.well-known/cdn.json- Push to GitHub.
- Settings → Pages → Source: GitHub Actions.
- The workflow at
.github/workflows/gh-pages.ymlbuilds and deploys on push tomain.baseURLis injected automatically.
- New site from Git, point at the repo.
netlify.tomlconfigures build, Hugo version, JSON CORS + cache headers, and.well-knownheaders. No further setup.
The JSON shape is defined in three small templates:
layouts/index.json— root cataloglayouts/_default/list.json— collection manifestlayouts/_default/single.json— per-asset descriptor
Add fields by editing those templates and the matching front matter.