Skip to content
Gabinson200Public

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

106 Commits

Folders and files

Repository files navigation

My blog site or alternatively https://gabinson200.github.io/blog/mindmap.html

RSS: https://gabinson200.github.io/blog/feed.xml

Semantic article graph

semantic.html places articles by meaning. You enter 1, 2, or 4 concepts and articles are plotted by their similarity to them. It reads semantic-index.json, which holds the chunk embeddings of every article in articles.json.

The index is rebuilt automatically by the "Update Semantic Index" GitHub Action whenever a markdown file or articles.json changes. To rebuild it locally (Node 20+):

npm install
npm run build:embeddings            # only re-embeds articles whose markdown changed
npm run build:embeddings -- --force # re-embed everything

The first run downloads the Xenova/all-MiniLM-L6-v2 model (about 23 MB) into .cache/.

Marginalia (visitor notes in the margins)

Articles with "commentary": true in articles.json (or commentary: true in their front matter) are laid out like a Talmud page: the article in the centre, visitors' notes in the margins beside the paragraph they're about. On narrow screens, or with the margins hidden, each paragraph with notes gets a "3 notes" toggle instead. Readers hover or tap a paragraph and press + to write.

  • Front end: scripts/marginalia.js and marginalia.css, loaded by article.html.
  • Back end: worker/index.js, a Cloudflare Worker with a D1 database (worker/migrations/). It checks every note with Cloudflare Turnstile and limits each visitor to 5 notes per 10 minutes and 30 a day. Notes are plain text, 1,000 characters at most.
  • Notes are tied to a fingerprint of their paragraph's text. If you rewrite a paragraph, its notes move to "notes on earlier versions" at the end of the article.
  • On GitHub Pages or a plain local server there's no API, so the margins say they're unavailable and nothing breaks.

Deleting notes: open any article on the site, run this once in the browser console, and a Delete link appears on every note:

localStorage.setItem('marginaliaAdminKey', '<your ADMIN_KEY>')

Local development (uses Cloudflare's always-pass Turnstile test keys from .dev.vars, which isn't committed):

npx wrangler d1 migrations apply blog-notes --local
npx wrangler dev        # http://localhost:8787

Hosting on Cloudflare

The whole repository is the site: wrangler.jsonc serves every file as a static asset (except what .assetsignore lists) and runs worker/index.js only for /api/*. Static files are free and unlimited; the API fits Workers' free plan (100,000 requests a day).

One-time setup:

  1. Domain: buy one in the Cloudflare dashboard (Domain Registration), or add a domain you already own to Cloudflare.
  2. Log in: npx wrangler login
  3. Database: npx wrangler d1 create blog-notes, put the database_id it prints into wrangler.jsonc, then create the table: npx wrangler d1 migrations apply blog-notes --remote
  4. Turnstile: in the dashboard, Turnstile > Add widget, hostname = your domain. Put the site key in wrangler.jsonc (TURNSTILE_SITE_KEY) and store the secret key: npx wrangler secret put TURNSTILE_SECRET
  5. Admin key: pick a long random string and store it: npx wrangler secret put ADMIN_KEY
  6. Deploy on every push: Workers & Pages > Create > Import a repository > this repo (deploy command npx wrangler deploy). Or deploy by hand with npx wrangler deploy.
  7. Custom domain: the Worker's Settings > Domains & Routes > Add > Custom domain.

Moving off GitHub Pages:

  1. In the GitHub repo, Settings > Secrets and variables > Actions > Variables: add NEW_SITE_ORIGIN = https://your-domain (no trailing slash).
  2. Settings > Pages > Source: GitHub Actions. The "GitHub Pages redirect" workflow then replaces the old site with pages that forward every gabinson200.github.io/blog/... URL to the same path on the new domain, and keeps copies of feed.xml, webring.json and the webring widget, so RSS readers and members' webring snippets keep working.
  3. Run the "Auto-Update RSS Feed" workflow once (Actions tab), so the feed's links use the new domain.
  4. Change your own entry in webring.json and the links at the top of this README to the new domain.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages