Snippets about Stati
35 snippets
-
SNP153
Find the slowest pages in a Stati 2 build
The metrics count the templates each page really rendered now, and the cache manifest names them.
11 lines of sh in 2 blocks, 18 lines of explanation.
#64A -
SNP152
Fail CI when a Stati 2 build falls back
A broken template still exits with 0, and a misspelled include leaves nothing in the page to find. The build log has all of it.
16 lines of sh in 1 block, 18 lines of explanation.
#B21 -
SNP151
Pick a layout per page in Stati 2
Layout names are looked up from the page's folder now, the same way as includes. And a typo finally gets a warning.
18 lines of yaml, text and eta in 4 blocks, 19 lines of explanation.
#594 -
SNP150
Template helpers in Stati 2
Stati 1's filters are helpers now, with a config key of their own. And their parameters can have real types.
20 lines of ts and eta in 2 blocks, 15 lines of explanation.
#A31 -
SNP149
Includes with props in Stati 2
A card component, included by its path. The guard Stati 1 components needed on their first line can go.
11 lines of eta in 4 blocks, 19 lines of explanation with 3 notes.
#2B7 -
SNP148
A page for every tag in Stati
One [tag].md template, URLs from Stati's slugify, and links that match them.
21 lines of yaml and eta in 4 blocks, 18 lines of explanation with 4 notes.
#415 -
SNP147
Paginate a listing in Stati
One line of front matter for numbered pages, and a pager built from stati.pagination.
31 lines of yaml and eta in 2 blocks, 15 lines of explanation with 5 notes.
#693 -
SNP146
Design your own link preview card in Stati
An og.eta that Satori can draw, a font of your own, and the rules it holds you to.
12 lines of sh, ts and eta in 3 blocks, 14 lines of explanation with 4 notes.
#924 -
SNP145
List a section's posts anywhere in Stati
The newest posts on the home page from one line of front matter, and prev/next links without a hook.
23 lines of yaml and eta in 3 blocks, 15 lines of explanation with 4 notes.
#1B3 -
SNP144
Images in Stati Markdown and layouts
Where image paths point, what Stati adds to the images, and stati.image() for covers.
7 lines of md, eta and ts in 3 blocks, 20 lines of explanation with 4 notes.
#A34 -
SNP141
Fail CI when a Stati build falls back
A broken config, layout or partial still exits with 0. Two greps catch them.
15 lines of sh in 1 block, 16 lines of explanation with 3 notes.
#241 -
SNP135
Different config for dev and production in Stati
getEnv() knows which command is running. NODE_ENV doesn't.
16 lines of ts in 1 block, 12 lines of explanation with 4 notes.
#529 -
SNP130
Find the slowest pages in a Stati build
Build metrics, the HTML report, and two jq one-liners.
8 lines of sh in 2 blocks, 13 lines of explanation.
#316 -
SNP126
Pages from a CMS in Stati
Write the CMS's posts as Markdown before the build starts. A hook is too late.
31 lines of js and json in 2 blocks, 8 lines of explanation.
#A25 -
SNP121
Compute page data in beforeAll, not beforeRender
A Stati hook that writes front matter in beforeRender makes those pages rebuild on every build.
20 lines of js in 2 blocks, 12 lines of explanation.
#471 -
SNP117
Keep Stati's build cache between CI runs
Cache .stati and dist together, or the next build starts from nothing anyway.
15 lines of yaml in 1 block, 11 lines of explanation.
#235 -
SNP112
ISG aging rules in Stati
Rebuild new posts often and old ones rarely, and the catch on a static host.
12 lines of ts in 1 block, 13 lines of explanation.
#61B -
SNP109
stati invalidate cheat sheet
Clear Stati's build cache by tag, path, glob or age, and what each query really matches.
17 lines of sh in 1 block, 10 lines of explanation with 4 notes.
#942 -
SNP105
Breadcrumbs from stati.nav
getBreadcrumbs() starts at the page's own folder. findNode() gives the whole trail.
27 lines of eta in 2 blocks, 9 lines of explanation.
#591 -
SNP101
Dynamic Tailwind classes in Stati
A class built from a variable never reaches Tailwind's scanner, unless stati.propValue() writes it down.
17 lines of eta, js and json in 3 blocks, 12 lines of explanation.
#B63 -
SNP098
Load a script only on some pages in Stati
Stati's TypeScript bundles with include and exclude, and how their patterns match.
19 lines of ts and eta in 2 blocks, 11 lines of explanation with 4 notes.
#42A -
SNP093
Search a Stati site in the browser
Stati writes the search index at build time. A few dozen lines of TypeScript search it.
39 lines of ts and html in 2 blocks, 11 lines of explanation with 3 notes.
#9B5 -
SNP089
Keep a page out of search engines in Stati
noindex, the sitemap and the site's own search, from the page's front matter and one config line.
11 lines of yaml and ts in 2 blocks, 12 lines of explanation.
#26B -
SNP085
An RSS feed for one folder in Stati
Why contentPatterns needs a **/ in front, and the link Stati doesn't add for you.
14 lines of ts and html in 2 blocks, 14 lines of explanation with 4 notes.
#349 -
SNP081
Your own title format with Stati's SEO tags
Write the <title> yourself and let Stati fill in the rest of the head.
10 lines of eta and yaml in 2 blocks, 12 lines of explanation.
#152 -
SNP078
A nested table of contents in Stati
stati.page.toc is a flat list. A few lines of Eta turn it into nested lists.
28 lines of eta in 1 block, 8 lines of explanation.
#A47 -
SNP075
Callout boxes in Stati Markdown
GitHub's > [!NOTE] syntax as a small markdown-it rule.
39 lines of js, ts, md and css in 4 blocks, 4 lines of explanation.
#3A1 -
SNP073
Add markdown-it plugins to Stati
Footnotes, containers and emoji, and the plugin that has to go through configure instead.
26 lines of sh, ts and md in 3 blocks, 12 lines of explanation with 4 notes.
#513 -
SNP069
Highlight code with Shiki in Stati
Build-time syntax highlighting with Shiki, ready before Stati's synchronous markdown.configure runs.
27 lines of sh, js and ts in 3 blocks, 11 lines of explanation with 3 notes.
#2B4 -
SNP066
Serve Stati's clean URLs from nginx
/about is about.html. The try_files line, the trailing slash redirect and the 404 page.
18 lines of nginx and ts in 2 blocks, 12 lines of explanation.
#742 -
SNP063
Class names with stati.propValue
Stati's own classnames, for class lists with conditions in them.
13 lines of eta in 1 block, 13 lines of explanation with 4 notes.
#13B -
SNP060
Custom template filters in Stati
A date format and a reading time, registered once in the config and called like functions.
22 lines of ts and eta in 2 blocks, 12 lines of explanation with 5 notes.
#495 -
SNP057
Pick a layout per page in Stati
How Stati finds a page's layout, and the typo it won't tell you about.
12 lines of yaml and text in 2 blocks, 18 lines of explanation with 3 notes.
#641 -
SNP053
Partials with props in Stati
A card component that takes data, and the one line that keeps it from breaking every page.
9 lines of eta in 2 blocks, 22 lines of explanation with 4 notes.
#359 -
SNP050
Eta tags in Stati templates
The three tags, the one variable, and the comment that breaks a template.
22 lines of eta in 2 blocks, 18 lines of explanation with 3 notes.
#B14