@nera-static/theme-stack 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +373 -2
- package/assets/css/theme.css +1640 -0
- package/assets/fonts/stack/OFL-bricolage-grotesque.txt +93 -0
- package/assets/fonts/stack/OFL-inter.txt +93 -0
- package/assets/fonts/stack/OFL-jetbrains-mono.txt +93 -0
- package/assets/fonts/stack/bricolage-grotesque-latin-ext-wght-normal.woff2 +0 -0
- package/assets/fonts/stack/bricolage-grotesque-latin-wght-normal.woff2 +0 -0
- package/assets/fonts/stack/inter-latin-ext-wght-italic.woff2 +0 -0
- package/assets/fonts/stack/inter-latin-ext-wght-normal.woff2 +0 -0
- package/assets/fonts/stack/inter-latin-wght-italic.woff2 +0 -0
- package/assets/fonts/stack/inter-latin-wght-normal.woff2 +0 -0
- package/assets/fonts/stack/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/assets/fonts/stack/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/config/theme.yaml +37 -0
- package/package.json +80 -5
- package/views/layouts/layout.pug +19 -0
- package/views/pages/archive.pug +20 -0
- package/views/pages/default.pug +8 -0
- package/views/pages/home.pug +40 -0
- package/views/pages/post.pug +59 -0
- package/views/pages/tag.pug +8 -0
- package/views/partials/card-media.pug +5 -0
- package/views/partials/feed-link.pug +4 -0
- package/views/partials/footer-extra.pug +4 -0
- package/views/partials/footer.pug +10 -0
- package/views/partials/head-extra.pug +4 -0
- package/views/partials/head.pug +14 -0
- package/views/partials/header.pug +8 -0
- package/views/partials/helpers.pug +215 -0
- package/views/partials/home-about.pug +14 -0
- package/views/partials/home-series.pug +14 -0
- package/views/partials/lang-switch.pug +13 -0
- package/views/partials/nav-main.pug +5 -0
- package/views/partials/page-header.pug +6 -0
- package/views/partials/post-card.pug +21 -0
- package/views/partials/post-media.pug +4 -0
- package/views/partials/post-pagination.pug +4 -0
- package/views/partials/post-tags.pug +3 -0
- package/views/partials/scripts-extra.pug +2 -0
- package/views/partials/scripts.pug +3 -0
- package/views/partials/tag-cloud.pug +4 -0
- package/views/partials/tag-overview.pug +8 -0
- package/views/partials/tokens.pug +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael Becker
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,374 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nera-static/theme-stack
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/seebaermichi/nera-theme-stack/actions/workflows/test.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@nera-static/theme-stack)
|
|
5
|
+
|
|
6
|
+
A blog theme for the [Nera](https://github.com/seebaermichi/nera) static site generator, made for people who write about code: code-first posts, series and type-only covers. It is presentation only — Pug views, one stylesheet, three self-hosted webfonts and a `config/theme.yaml` of design tokens.
|
|
7
|
+
|
|
8
|
+
📖 **Documentation:** [nera.js.org](https://nera.js.org)
|
|
9
|
+
|
|
10
|
+
- **"Stack"**: a light grey page, white cards with a 2 px ink border and a hard offset shadow, one red, one lime, dark panels for code. Headings in Bricolage Grotesque, text in Inter, labels, dates and code in JetBrains Mono.
|
|
11
|
+
- **Type as picture**: a post without an `image` gets a coloured cover with its first tag in large type, the colour following its place in the list.
|
|
12
|
+
- **No JavaScript** and **no third-party request**: the fonts are served from your own site, every URL the theme emits is a path on your site, and it works under a `base_path`.
|
|
13
|
+
- **Accessible by default**: skip link, one `<main id="main">`, one `<h1>` per page, labelled navigation, visible focus, a language switch with `hreflang` and `lang`, contrast of at least 4.5:1 for every default colour pair, no motion for visitors who asked for less.
|
|
14
|
+
- **Plugins are optional**: plugin output reaches a page only through *seams* you fill; without a plugin the seam renders nothing.
|
|
15
|
+
- **Interchangeable with the other Nera blog themes**: the same page types, frontmatter and `config/theme.yaml` keys as `@nera-static/theme-blog`, so a blog switches by changing `theme:`.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @nera-static/theme-stack
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
In your site's `config/app.yaml`:
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
theme: stack
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The theme needs Nera's engine, `@nera-static/core`, **4.15.0 or later** (`"nera": { "generator": ">=4.15.0" }`); an older one fails the build with a message naming the range. Keep a `theme/views/` folder in your site (it holds your vendor copies and seam overrides anyway), and remove the `nera new` starter files `theme/views/layouts/layout.pug` and `theme/views/pages/default.pug` if they still carry the `nera:scaffold-default` line, or they hide the theme's files (`nera validate` warns with `theme-shadowed`).
|
|
30
|
+
|
|
31
|
+
## Page types
|
|
32
|
+
|
|
33
|
+
Set a page's `layout` to one of these:
|
|
34
|
+
|
|
35
|
+
| `layout:` | for | renders |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `pages/home.pug` | the front page | the hero (`title`, `lead`, a button to `archive_href`, the page's Markdown body on the right), the `tag-cloud` seam as a dark band, the newest post as a wide card ("Latest post"), the next posts as cards ("Recent posts"), the featured series, the about block |
|
|
38
|
+
| `pages/post.pug` | one post | header (series line, title, lead, author line with published and updated date), the `post-media` seam when the post has an `image`, its `facts` beside the text, the body, then the `post-tags` seam, the parts of its series and the `post-pagination` seam |
|
|
39
|
+
| `pages/archive.pug` | all posts | page header, body, the posts grouped by year (newest first, with the number of posts), the `tag-cloud` seam as a band |
|
|
40
|
+
| `pages/tag.pug` | the tag pages of `@nera-static/plugin-tags` | the `tag-overview` seam, which owns the page's `<h1>` |
|
|
41
|
+
| `pages/default.pug` | about, legal pages, anything else | page header, body |
|
|
42
|
+
|
|
43
|
+
The page header is the page's only `<h1>` (from `title`), so **start a page's Markdown at `##`**.
|
|
44
|
+
|
|
45
|
+
**The home's body** sits beside the title. The theme is built for one `bash` fence there, which `@nera-static/plugin-code-blocks` renders as a terminal card on a red offset block:
|
|
46
|
+
|
|
47
|
+
````markdown
|
|
48
|
+
---
|
|
49
|
+
layout: pages/home.pug
|
|
50
|
+
title: Laravel, AI, and the bugs in between.
|
|
51
|
+
lead: Field notes on shipping LLM features with PHP.
|
|
52
|
+
archive_href: /archive.html
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
```bash:terminal
|
|
56
|
+
composer require laravel/reverb
|
|
57
|
+
php artisan reverb:start
|
|
58
|
+
```
|
|
59
|
+
````
|
|
60
|
+
|
|
61
|
+
Without a body the hero is the title column alone.
|
|
62
|
+
|
|
63
|
+
**Posts** are the pages whose `layout` is listed in `blog.post_layouts` (default `['pages/post.pug']`) and whose language is the current page's, newest first by date, ties broken by URL. Give every post a `date`. Prev/next comes from `@nera-static/plugin-page-pagination`, which pairs pages of the same folder (the older post is "previous"), so keep the posts of one language in a folder of their own (`pages/posts/`, `pages/de/posts/`).
|
|
64
|
+
|
|
65
|
+
Frontmatter the views read:
|
|
66
|
+
|
|
67
|
+
| key | type | read by |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `title` | string | every page (`<title>`, the `<h1>`, card and archive titles) |
|
|
70
|
+
| `description` | string | every page (`<meta name="description">`); the text on a card |
|
|
71
|
+
| `lead` | string | home hero, page and post header |
|
|
72
|
+
| `robots` | string | `<meta name="robots">` (else `robots` in `config/app.yaml`) |
|
|
73
|
+
| `lang` | string | `<html lang>`, the post selection, dates, `t()` (else `lang` in `config/app.yaml`) |
|
|
74
|
+
| `slug` | string | the language switch: translations of one page share a `slug` |
|
|
75
|
+
| `date` | date | post, cards, archive (becomes `meta.createdAt`) |
|
|
76
|
+
| `updated` | date | post |
|
|
77
|
+
| `author` | string | post: the author line (else `author.name` of `config/theme.yaml`) |
|
|
78
|
+
| `archive_href` | site path | home: the "All posts" button and link |
|
|
79
|
+
| `image`, `image_alt` | path, string | a post with `image` shows its picture through the `post-media` and `card-media` seams instead of a type cover |
|
|
80
|
+
| `tags` | list of strings | the type cover shows the first tag; plugin-tags reads the list for the tag links and pages |
|
|
81
|
+
| `series`, `series_part` | string, integer | above the title: "Series: `<name>` · Part `<n>`"; under the post: the parts of the series in the page's language, ordered by `series_part`, the current one marked |
|
|
82
|
+
| `facts` | list of `{ label, value }`, at most four | a small box beside the text (`Laravel 12.4`, `PHP 8.4`) |
|
|
83
|
+
|
|
84
|
+
Dates are printed with `toLocaleDateString(<page language>, { year: 'numeric', month: 'long', day: 'numeric' })` in UTC; archive rows print day and month only, under their year.
|
|
85
|
+
|
|
86
|
+
## Seams: where plugin output goes
|
|
87
|
+
|
|
88
|
+
A seam is a partial the theme ships empty (or with a plugin-free default). You fill it by putting a file with the same path into your site's `theme/views/`. The theme never reads plugin data itself, so a theme update cannot break on a plugin's data shape. Publish each plugin's templates into your site first (`npx nera-<plugin>`, for example `npx nera-tags`); they land in `theme/views/vendor/plugin-<name>/`.
|
|
89
|
+
|
|
90
|
+
| seam (`theme/views/…`) | where | in scope | typical override |
|
|
91
|
+
|---|---|---|---|
|
|
92
|
+
| `partials/head-extra.pug` | end of `<head>` | `app`, `meta` | canonical and alternate links |
|
|
93
|
+
| `partials/feed-link.pug` | end of `<head>`, before `head-extra.pug` | `app`, `meta` | plugin-feed |
|
|
94
|
+
| `partials/nav-main.pug` | inside the header's `<nav>` | `app`, `meta` | plugin-navigation (a "Feed" entry goes into its menu) |
|
|
95
|
+
| `partials/footer-extra.pug` | footer, before the legal links | `app`, `meta` | plugin-social-media-links |
|
|
96
|
+
| `partials/scripts-extra.pug` | end of `<body>` | `app`, `meta` | your own `<script type="module">` |
|
|
97
|
+
| `partials/post-media.pug` | `div.post__media` of a post with `image` | `meta` | plugin-images |
|
|
98
|
+
| `partials/card-media.pug` | `div.post-card__media` of a card with `image` | `item` (the post) | plugin-images |
|
|
99
|
+
| `partials/post-tags.pug` | `div.post__tags` of a post | `meta` | plugin-tags |
|
|
100
|
+
| `partials/post-pagination.pug` | `div.post__pagination` of a post | `meta` | plugin-page-pagination |
|
|
101
|
+
| `partials/tag-overview.pug` | `section.tag-page` | `meta`, `app` | plugin-tags. Default without the plugin: `h1.page__title` and the body |
|
|
102
|
+
| `partials/tag-cloud.pug` | home (after the hero) and archive (at the end) | `app`, `meta` | plugin-tags |
|
|
103
|
+
|
|
104
|
+
The overrides, ready to copy:
|
|
105
|
+
|
|
106
|
+
```pug
|
|
107
|
+
//- theme/views/partials/feed-link.pug — npx nera-feed (needs `origin` in config/app.yaml)
|
|
108
|
+
include /vendor/plugin-feed/feed-link
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```pug
|
|
112
|
+
//- theme/views/partials/nav-main.pug — npx nera-navigation
|
|
113
|
+
//- One menu per language (elements.main_en, elements.main_de in config/navigation.yaml).
|
|
114
|
+
include /vendor/plugin-navigation/partials/link-list-navigation
|
|
115
|
+
+linkListNav(((app.nav || {})[`main_${meta.lang || app.lang}`] || { elements: [] }).elements, '', (meta.lang || app.lang) === app.lang ? '/' : `/${meta.lang}`)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```pug
|
|
119
|
+
//- theme/views/partials/footer-extra.pug — npx nera-social-media-links
|
|
120
|
+
//- Never include fontawesome-cdn-link.pug: it loads icons from a CDN.
|
|
121
|
+
include /vendor/plugin-social-media-links/social-media-links
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```pug
|
|
125
|
+
//- theme/views/partials/post-media.pug — npx nera-images
|
|
126
|
+
include /vendor/plugin-images/picture
|
|
127
|
+
+picture(meta.images && meta.images.image, { alt: meta.image_alt, class: 'post__image', loading: 'eager' })
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```pug
|
|
131
|
+
//- theme/views/partials/card-media.pug
|
|
132
|
+
include /vendor/plugin-images/picture
|
|
133
|
+
+picture(item.meta.images && item.meta.images.image, { alt: item.meta.image_alt, class: 'post-card__image' })
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
```pug
|
|
137
|
+
//- theme/views/partials/post-tags.pug — npx nera-tags
|
|
138
|
+
include /vendor/plugin-tags/partials/tag-links
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```pug
|
|
142
|
+
//- theme/views/partials/tag-overview.pug
|
|
143
|
+
include /vendor/plugin-tags/pages/tag-overview
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```pug
|
|
147
|
+
//- theme/views/partials/tag-cloud.pug
|
|
148
|
+
include /vendor/plugin-tags/partials/tag-cloud
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```pug
|
|
152
|
+
//- theme/views/partials/post-pagination.pug — npx nera-page-pagination
|
|
153
|
+
include /vendor/plugin-page-pagination/page-pagination
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## What a post may contain
|
|
157
|
+
|
|
158
|
+
Pictures and code inside a post come from the plugins' output, which the theme only styles. No raw HTML and no special classes are needed:
|
|
159
|
+
|
|
160
|
+
- a fenced code block → plugin-code-blocks' dark panel with the file name (```` ```php:app/Events/TokenReceived.php ````); a `diff` fence marks added and removed lines; a `bash` fence gets `$` prompts;
|
|
161
|
+
- a blockquote → the lime note box; a leading `**bold**` reads as its title;
|
|
162
|
+
- a Markdown table → the benchmark table (mono header, figures right-aligned);
|
|
163
|
+
- `` → plugin-images' `figure.nera-image` with its caption;
|
|
164
|
+
- a bulleted list → red square bullets.
|
|
165
|
+
|
|
166
|
+
## Configuration: `config/theme.yaml`
|
|
167
|
+
|
|
168
|
+
The theme's `config/theme.yaml` holds every key with a default. Your site's `config/theme.yaml` is deep-merged over it: set only what you change. Arrays are replaced as a whole.
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
label: Stack
|
|
172
|
+
tokens:
|
|
173
|
+
color:
|
|
174
|
+
bg: '#f4f5f7' # page background
|
|
175
|
+
surface: '#ffffff' # cards, boxes, buttons
|
|
176
|
+
text: '#101319' # body text, the 2px ink borders
|
|
177
|
+
muted: '#555d6b' # dates, captions, meta lines, the footer
|
|
178
|
+
accent: '#d02408' # links, the primary button, bullets, active navigation
|
|
179
|
+
accent_text: '#ffffff' # text on accent
|
|
180
|
+
border: '#d9dde4' # hairlines, the shadow of code panels
|
|
181
|
+
focus: '#1d4fe0' # the :focus-visible outline
|
|
182
|
+
night: '#12151c' # code panels, the series blocks
|
|
183
|
+
night_text: '#e7eaf0' # text on night
|
|
184
|
+
night_muted: '#98a2b3' # muted text on night
|
|
185
|
+
highlight: '#d8f24a' # lime: the note box, series numbers, the author mark
|
|
186
|
+
font:
|
|
187
|
+
body: "'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"
|
|
188
|
+
heading: "'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"
|
|
189
|
+
mono: "'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace"
|
|
190
|
+
size:
|
|
191
|
+
base: '1.0625rem' # body text size
|
|
192
|
+
measure: '46rem' # width of the reading column
|
|
193
|
+
width: '73rem' # width of header, lists and footer
|
|
194
|
+
radius: '0' # corners
|
|
195
|
+
space: '1.5rem' # vertical rhythm
|
|
196
|
+
extra_css: []
|
|
197
|
+
footer_links: []
|
|
198
|
+
blog:
|
|
199
|
+
post_layouts: ['pages/post.pug']
|
|
200
|
+
home_posts: 7
|
|
201
|
+
featured_series: ''
|
|
202
|
+
highlight_tag: ''
|
|
203
|
+
author:
|
|
204
|
+
name: ''
|
|
205
|
+
bio: ''
|
|
206
|
+
href: ''
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
| key | meaning |
|
|
210
|
+
|---|---|
|
|
211
|
+
| `tokens.<group>.<name>` | each token becomes the CSS custom property `--theme-<group>-<name>` (`_` → `-`) in an inline `<style>`; a value containing `<`, `>`, `{`, `}` or `;` is dropped. `theme.css` repeats every default, so the page is styled even if the `<style>` is blocked. |
|
|
212
|
+
| `extra_css` | stylesheets linked after `theme.css`. Only root-absolute paths (`/css/custom.css`) are linked. |
|
|
213
|
+
| `footer_links` | the footer's legal links: `{ label, href }`; `label` goes through `t()`, `href` is a path or a `{ <lang>: path }` map. |
|
|
214
|
+
| `blog.post_layouts` | the layouts that make a page a post |
|
|
215
|
+
| `blog.home_posts` | how many posts the home lists: the first as the wide card, the rest as cards (default 7: one and two rows of three) |
|
|
216
|
+
| `blog.featured_series` | a `series` name: the home shows its parts as a numbered list on a dark block, with a "Read more" link to part one. Nothing when no post of the page's language belongs to it. |
|
|
217
|
+
| `blog.highlight_tag` | read by the other Nera blog themes; Stack renders nothing for it |
|
|
218
|
+
| `author.name`, `author.bio`, `author.href` | the about block on the home (the initials of the name in a lime mark, "About the author", the name, the bio, a "Read more" link to `href`) and the author line of a post. `href` is a path or a `{ <lang>: path }` map. Without `name` neither is rendered; a post's own `author` wins on that post. |
|
|
219
|
+
|
|
220
|
+
A blog with code blocks, an author and legal pages in English and German:
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
# your site's config/theme.yaml
|
|
224
|
+
extra_css: ['/_nera/code-blocks.css']
|
|
225
|
+
footer_links:
|
|
226
|
+
- label: Imprint
|
|
227
|
+
href: { en: /imprint.html, de: /de/impressum.html }
|
|
228
|
+
- label: Privacy
|
|
229
|
+
href: { en: /privacy.html, de: /de/datenschutz.html }
|
|
230
|
+
blog:
|
|
231
|
+
featured_series: RAG from scratch in Laravel
|
|
232
|
+
author:
|
|
233
|
+
name: Jonas Brandt
|
|
234
|
+
bio: Backend developer in Leipzig.
|
|
235
|
+
href: { en: /about.html, de: /de/ueber-mich.html }
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Code blocks.** `theme.css` sets `@nera-static/plugin-code-blocks`' custom properties on `.nera-code` and `.nera-code-scope`: `--nera-code-bg`, `-ink` and `-muted` from the `night` tokens, `-font` and `-radius` from `font.mono` and `size.radius`, and fixed colours for keywords, strings and names. Link the plugin's stylesheet with `extra_css: ['/_nera/code-blocks.css']`; the theme never links `/_nera/…` itself. The theme ships no JavaScript, so set `copy_button: false` in `config/code-blocks.yaml`, or load `/_nera/code-blocks.js` from `scripts-extra.pug`.
|
|
239
|
+
|
|
240
|
+
**Fonts.** The theme ships its three families as `.woff2` under `assets/fonts/stack/` (in your output: `/fonts/stack/`), Latin and Latin Extended subsets each, with `font-display: swap` and relative URLs, so they work under a `base_path`. To use another family, self-host it and name it in `tokens.font.*`; the theme's own files are only downloaded where their family is used.
|
|
241
|
+
|
|
242
|
+
| family | files | source |
|
|
243
|
+
|---|---|---|
|
|
244
|
+
| Bricolage Grotesque (variable, 200–800) | `bricolage-grotesque-latin{,-ext}-wght-normal.woff2` | `@fontsource-variable/bricolage-grotesque` 5.3.0 |
|
|
245
|
+
| Inter (variable, upright and italic) | `inter-latin{,-ext}-wght-{normal,italic}.woff2` | `@fontsource-variable/inter` 5.3.0 |
|
|
246
|
+
| JetBrains Mono (variable, upright) | `jetbrains-mono-latin{,-ext}-wght-normal.woff2` | `@fontsource-variable/jetbrains-mono` 5.3.0 |
|
|
247
|
+
|
|
248
|
+
All three are under the SIL Open Font License 1.1; the licence texts ship beside the files (`OFL-<family>.txt`).
|
|
249
|
+
|
|
250
|
+
## Translations
|
|
251
|
+
|
|
252
|
+
Every string the theme renders goes through `t()` with an English key, so an English site needs nothing. For other languages add the keys under `translations.<lang>` in `config/app.yaml`:
|
|
253
|
+
|
|
254
|
+
```yaml
|
|
255
|
+
translations:
|
|
256
|
+
en:
|
|
257
|
+
language_name: English
|
|
258
|
+
de:
|
|
259
|
+
language_name: Deutsch
|
|
260
|
+
Skip to content: Zum Inhalt springen
|
|
261
|
+
Main navigation: Hauptnavigation
|
|
262
|
+
Language: Sprache
|
|
263
|
+
Legal: Rechtliches
|
|
264
|
+
Latest post: Neuester Beitrag
|
|
265
|
+
Recent posts: Neueste Beiträge
|
|
266
|
+
All posts: Alle Beiträge
|
|
267
|
+
Published: Veröffentlicht
|
|
268
|
+
Updated: Aktualisiert
|
|
269
|
+
Series: Serie
|
|
270
|
+
Part: Teil
|
|
271
|
+
About the author: Über den Autor
|
|
272
|
+
Read more: Weiterlesen
|
|
273
|
+
posts: Beiträge
|
|
274
|
+
# your footer_links labels
|
|
275
|
+
Imprint: Impressum
|
|
276
|
+
Privacy: Datenschutz
|
|
277
|
+
# plugin-page-pagination
|
|
278
|
+
Pagination: Blätternavigation
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
| key | where |
|
|
282
|
+
|---|---|
|
|
283
|
+
| `Skip to content` | the skip link |
|
|
284
|
+
| `Main navigation`, `Language`, `Legal` | `aria-label` of the header navigation, the language switch, the footer's legal links |
|
|
285
|
+
| `Latest post`, `Recent posts` | headings of the home's two post lists |
|
|
286
|
+
| `All posts` | the hero button and the link beside "Recent posts" |
|
|
287
|
+
| `Published`, `Updated` | a post's author line |
|
|
288
|
+
| `Series`, `Part` | the series line above a post's title, the label of the home's series block, the `aria-label` of a post's series list |
|
|
289
|
+
| `About the author`, `Read more` | the home's about block; `Read more` also links to part one of the featured series (and is plugin-tags' link text on tag pages) |
|
|
290
|
+
| `posts` | the count under a year in the archive ("8 posts") |
|
|
291
|
+
| `language_name` | each language's own name in the language switch |
|
|
292
|
+
|
|
293
|
+
The language switch appears when `translations` has two or more languages and another language has a page to link: the page with the same `slug`, else that language's home page.
|
|
294
|
+
|
|
295
|
+
## Overriding the theme
|
|
296
|
+
|
|
297
|
+
| to change | do this | keeps theme updates for |
|
|
298
|
+
|---|---|---|
|
|
299
|
+
| a colour, a font, a width | the token in your `config/theme.yaml` | everything |
|
|
300
|
+
| a few CSS rules | `theme/assets/css/custom.css` + `extra_css: ['/css/custom.css']` | everything |
|
|
301
|
+
| where plugin output goes | override a seam | every other file |
|
|
302
|
+
| one partial or page type | copy it to `theme/views/<same path>` | every other file |
|
|
303
|
+
| the whole shell | override `layouts/layout.pug` | page types, partials, CSS |
|
|
304
|
+
| a new page type | `theme/views/pages/<name>.pug` with `extends ../layouts/layout.pug` | everything |
|
|
305
|
+
|
|
306
|
+
The layout defines the blocks `head`, `header`, `main`, `footer` and `scripts`. The views and partials, all part of the contract: `layouts/layout.pug`; `partials/head.pug`, `tokens.pug`, `helpers.pug`, `header.pug`, `lang-switch.pug`, `footer.pug`, `scripts.pug`, `page-header.pug`, `post-card.pug` (one post in a list; `item`, `position` and `featured` in scope), `home-series.pug` and `home-about.pug`; the seams above; the five page types.
|
|
307
|
+
|
|
308
|
+
`partials/helpers.pug` defines `pageLang(page)`, `sameLang(page)`, `homeHref(lang)`, `formatDate(value, lang)`, `isoDate(value)` and `hrefFor(value, lang)`. A layout of your own includes it first. It also defines `themeStack`, an object the theme's own views use internally; it is not part of the contract.
|
|
309
|
+
|
|
310
|
+
### Classes
|
|
311
|
+
|
|
312
|
+
The theme's public classes, safe to style in your `custom.css`:
|
|
313
|
+
|
|
314
|
+
- shell: `skip-link`, `site-header`, `site-header__inner`, `site-header__brand`, `site-header__nav`, `lang-switch`, `lang-switch__list`, `lang-switch__item`, `lang-switch__link`, `site-main`, `page__header`, `page__title`, `page__lead`, `page__body`, `site-footer`, `site-footer__inner`, `site-footer__legal`, `site-footer__copy`
|
|
315
|
+
- home: `home-hero`, `home-hero__inner`, `home-hero__title`, `home-hero__lead`, `home-hero__actions`, `home-hero__aside`, `button`, `button--primary`, `home-series`, `home-about`, `home-about__mark`, `home-about__links`
|
|
316
|
+
- lists: `post-list`, `post-list__title`, `post-list__items`, `post-list__item`, `post-list__more`, `post-card`, `post-card--featured`, `post-card__media`, `post-card__image`, `post-card__cover`, `post-card__cover--{red,night,lime,paper,blue,mint}`, `post-card__body`, `post-card__title`, `post-card__link`, `post-card__excerpt`, `post-card__meta`, `post-card__date`, `post-archive__year`, `post-archive__count`, `post-archive__list`, `post-archive__item`, `tag-page`
|
|
317
|
+
- post: `post`, `post__header`, `post__series`, `post__title`, `post__lead`, `post__meta`, `post-author`, `post-author__mark`, `post-author__name`, `post__author`, `post__date`, `post__updated`, `post__media`, `post__image`, `post-facts`, `post-facts__item`, `post-facts__label`, `post-facts__value`, `post__body`, `post__footer`, `post__tags`, `post-series`, `post-series__title`, `post-series__list`, `post-series__item`, `post-series__item--current`, `post__pagination`
|
|
318
|
+
|
|
319
|
+
The plugin classes the theme styles, all optional peer dependencies:
|
|
320
|
+
|
|
321
|
+
| plugin | peer range | classes |
|
|
322
|
+
|---|---|---|
|
|
323
|
+
| `@nera-static/plugin-tags` | `^3.4.1` | `tag-cloud`, `tag-cloud__item`, `tag-links`, `tag-links__item`, `tag-overview` and its elements (`__header`, `__title`, `__image`, `__content`, `__item`, `__item-title`, `__item-date`, `__item-description`, `__item-link`) |
|
|
324
|
+
| `@nera-static/plugin-page-pagination` | `^2.4.0` | `page-pagination`, `page-pagination__link`, `page-pagination__link--previous`, `page-pagination__link--next` |
|
|
325
|
+
| `@nera-static/plugin-code-blocks` | `^1.2.1` | `nera-code`, `nera-code-scope`, `nera-code__bar`, `nera-code__title`, `nera-code__pre`, `hljs-addition`, `hljs-deletion` |
|
|
326
|
+
| `@nera-static/plugin-images` | `^1.0.3` | `nera-image`, `nera-image__caption` |
|
|
327
|
+
| `@nera-static/plugin-navigation` | `^3.1.0` | `nav`, `nav--list`, `nav__item`, `nav__link`, `nav__link--active`, `nav__link--active-path` — only inside `.site-header__nav` |
|
|
328
|
+
| `@nera-static/plugin-social-media-links` | `^2.3.0` | `social-media-links` and its elements — only inside `.site-footer` |
|
|
329
|
+
|
|
330
|
+
## What your site must do
|
|
331
|
+
|
|
332
|
+
The theme guarantees its own markup. Your content and the plugin output are yours; for `nera check` to report nothing:
|
|
333
|
+
|
|
334
|
+
1. Keep a `theme/views/` folder, and delete the `nera:scaffold-default` starter files from it.
|
|
335
|
+
2. Publish every plugin template you use (`npx nera-<plugin>`) and fill the seams; keep plugin-navigation's default class names and call `+linkListNav` (with `rootPath` for a language folder).
|
|
336
|
+
3. Use `@nera-static/plugin-page-pagination` 2.4.0 or later and translate `Pagination`.
|
|
337
|
+
4. Never include `fontawesome-cdn-link.pug`; set `open_in_new_tab: false` in `config/social-media-links.yaml`.
|
|
338
|
+
5. Set `footer_links` to your imprint and privacy pages, per language, with labels the legal checks recognise (`Imprint`/`Impressum`, `Privacy`/`Datenschutz`).
|
|
339
|
+
6. Translate every theme key, `language_name` per language, and your `footer_links` labels.
|
|
340
|
+
7. Start page bodies at `##`, give every image an `alt`, every post a `date`, and the translations of one page the same `slug`.
|
|
341
|
+
8. With plugin-tags: `tag_overview_layout: 'pages/tag.pug'` in `config/tags.yaml` (and `group_by_lang: true` on a multilingual site). With plugin-code-blocks: `extra_css: ['/_nera/code-blocks.css']` and `copy_button: false`. With plugin-images: `widths: [480, 800, 1600, 2400]` and `eager_first: false` in `config/images.yaml`.
|
|
342
|
+
|
|
343
|
+
`test/site/` in this repository is a complete example: the sample blog "tinker.log" in English and German with every step above applied, checked in CI with every `nera check` rule on. Its one picture is a generated placeholder made for this repository.
|
|
344
|
+
|
|
345
|
+
## Accessibility and privacy
|
|
346
|
+
|
|
347
|
+
- Skip link first, one `<main id="main">`, one `<h1>`, no skipped heading level, every theme `<nav>` labelled, `<html lang>` always set, a zoomable viewport, no `target="_blank"`. The type covers are decorative (`aria-hidden`): the card's title carries the link.
|
|
348
|
+
- `:focus-visible` gets a 3 px outline in the `focus` colour. The card and button shifts on hover run only for visitors without a reduced-motion preference.
|
|
349
|
+
- The eight default colour pairs and the theme's four `night`/`highlight` pairs reach at least 4.5:1.
|
|
350
|
+
- No JavaScript, no cookies or device storage, no request to another host: the fonts come from your site. Narrow screens are handled by CSS alone; below 900 px every grid stacks to one column.
|
|
351
|
+
|
|
352
|
+
## Versioning
|
|
353
|
+
|
|
354
|
+
The theme follows semantic versioning over its contract: view, partial, seam and block paths; token names and every `config/theme.yaml` key; the `t()` keys; the frontmatter and `app.*` keys it reads; the public classes; the plugin classes it styles.
|
|
355
|
+
|
|
356
|
+
| change | release |
|
|
357
|
+
|---|---|
|
|
358
|
+
| remove or rename any of these, change an element or its nesting under a public class, change what a key means, raise the `nera.generator` floor, drop a plugin major | major |
|
|
359
|
+
| add a view, seam, block, token, key or class; add a plugin major to a peer range; change a token's default | minor (a new `t()` key is named in the [changelog](CHANGELOG.md)) |
|
|
360
|
+
| a CSS or markup fix that keeps the contract, an accessibility fix, docs | patch |
|
|
361
|
+
|
|
362
|
+
## Development
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
npm ci
|
|
366
|
+
npm run lint
|
|
367
|
+
npx vitest run # builds the fixture site in temporary copies and checks it
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
To look at the fixture site: `cd test/site && npx nera build && npx nera serve`.
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
MIT. The fonts under `assets/fonts/stack/` are under the SIL Open Font License 1.1 (see the `OFL-*.txt` files beside them).
|