Source for https://crabmusket.net
- HTML 65.8%
- JavaScript 22.2%
- CSS 10.2%
- Just 1.8%
| _includes | ||
| content | ||
| css | ||
| .editorconfig | ||
| .gitignore | ||
| _redirects | ||
| eleventy.config.js | ||
| favicon.svg | ||
| justfile | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
crabmusket.net
Deployment to Cloudflare
- Created a new project from Github
- Chose Eleventy preset
- Set
NODE_VERSION=20.18in environment variables
Development
npm run dev
open localhost:8080/
Features
Notes to my future self:
Redirects from old site
- Posts used to be at
/blog/:slug, now they're just at/:slug - Wildcard redirect in _redirects tells Cloudflare to make that happen. It is included in the output using
eleventyConfig.addPassthroughCopy("_redirects") - See docs: https://developers.cloudflare.com/pages/configuration/redirects/
Icons
- Using inlined Feather icons
- They live in _includes/icons
- e.g.
{% include 'icons/mail.html' %}
Content structure
- Each micro blog post is tagged
blog - Each long read is tagged
article - Other tags are used to create the topic pages
- In several places, the custom
exceptfilter is used to excludeblogandarticlewhere needed
Topic pages
- Eleventy's collections are paginated to create one page per tag except the "internal" ones like
blogandarticle - Each topic can have its own little explanatory fragment included from _includes/topics
Year pages
- Blog posts' publication years are automatically shoved into a new collection called
blogYears. - This collection is paginated to create the year pages e.g.
/2024. - The
withPageYearcustom filter selects posts for each year page
just
- justfile has a script to generate a 'linkdump' post
- vscode-just can run
justcommands from the palette, which makes it easy to create a pre-formatted new post with today's date
main.css
- Something is aggressively caching main.css to 8 days on the client
- So, if important CSS changes, bust caches by incrementing the date in _includes/main-style.html