Skip to content

Instantly share code, notes, and snippets.

View bertrandkeller's full-sized avatar

Bertrand Keller bertrandkeller

View GitHub Profile
@RickCogley
RickCogley / 1. Readme.md
Last active May 28, 2023 23:36
Deploy Hugo to Deno Deploy via Github Actions

Background

Deno Deploy is an excellent, performant and cost-effective service geared toward hosting Deno apps at the edge. It can easily host a folder of static HTML files, if you provide an index.ts to launch something like "oak" to serve them (example index.ts below).

(It's important to note that it's still officially considered beta as of May 2023, and there have been some surprising periods of downtime over the past few months... just be sure to keep that in mind)

Hugo is a phenomenally fast-building and mature SSG, which can produce a folder of static files, but requires a build step like hugo --gc --minify --verbose --baseURL=$HUGOBASEURL --ignoreCache to generate them.

Below is a yaml file you would place in your project's .github/workflows folder. If you link your Deno Deploy project using Github Actions instead of specifying an index file, it will defer to what's in this. In this case, the Hugo files generated into public are being serv

@bencleary
bencleary / search.js
Created May 15, 2020 19:56
Generates a JSON index file that can be used for searching on your static site.
const toml = require("toml");
const fs = require("fs");
const path = require("path");
const inDirectory = path.join(__dirname, "..", "content", "posts");
const outDirectory = path.join(__dirname, "..", "static", "assets", "js");
class Index {
filePathQueue = [];
indexes = [];