An static, Eleventy blog, with dynamic markup generated by Cloudflare Workers.
See it in action here
- Clone the repo
git clone [email protected]:jkup/dynamic-static-11ty.git
- npm install
npm install
- npx eleventy to generate the static site
npx @11ty/eleventy
- Set your Worker name in
wrangler.toml
. It's currently "dynamic-static-11ty" but you can make it anything you want. - Sign up for a Workers account and install the CLI. Instructions can be found here
- Wrangler login
wrangler login
- Publish your Worker!
wrangler publish
- Create an empty GitHub repo
- Clone the 11ty starter blog into a new folder
git clone https://github.com/11ty/eleventy-base-blog.git your-repo-name
- Override the base blog origin to your new repo
git remote set-url origin [email protected]:your/repo.git
- Initialize a Wokers Sites project in this repo
wrangler init --site your-repo-name
- Open
workers-site/index.js
- Add any KV Store or HTMLRewriter code you want before it sets headers and returns a response.
- Publish to Workers!
wrangler publish
Note: You'll have to run npx eleventy
before wrangler publish
because wrangler will just grab whatever is currently in _site/
.