Static site hosting via tangled
JavaScript 100.0%
Other 0.1%
28 1 0

Clone this repository

https://tangled.org/gracekind.net/tangled-pages
git@knot.gracekind.net:gracekind.net/tangled-pages

For self-hosted knots, clone URLs may differ based on your setup.

README.md

tangled-pages#

A simple way to host a website via a tangled repo. You can run it as a cloudflare worker or as an express server.

Setup#

Create a config.json for your site(s).

{
  "site": {
    "ownerDid": "did:plc:p572wxnsuoogcrhlfrlizlrb",
    "repoName": "tangled-pages-example",
    "knotDomain": "knot.gracekind.net", // optional, but recommended in workers to avoid an extra request
    "branch": "main", // optional, defaults to main
    "baseDir": "/public", // optional, defaults to the repo root
    "notFoundFilepath": "/404.html" // optional, defaults to text 404
  },
  "cache": true // server only, not supported in workers (yet)
}

See config.multiple.example.json for an example of a multi-site config.

Then:

npm install
npx tangled-pages --config config.json

Example#

You can see an example of a hosted site here.

Limitations#

When cache: false, the server fetches files from the repo on every request, so it might be slow.

To-do#

  • support cache: true in workers
  • disk caching
  • preloading