Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,28 @@ jobs:
docker cp wordpress/. "$cid:/theme"
docker cp tools/wp-dev/. "$cid:/harness"
docker start -a "$cid"

jekyll:
name: Jekyll theme on GitHub Pages (Jekyll 3.10) and Jekyll 4.4
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# Builds the demo, the starter and the fixtures on both engines. A build
# that prints any warning fails.
- name: Build every site on both engines
run: |
set -euo pipefail
tools/jekyll-dev/jekyll-dev.sh images
tools/jekyll-dev/jekyll-dev.sh build
# Same-HTML, link, design-parity and browser checks, in the Playwright
# image that matches tools/package.json.
- name: Check the builds
run: |
set -euo pipefail
cid="$(docker create -w /repo mcr.microsoft.com/playwright:v1.61.0-noble bash -c 'npm ci --prefix tools --no-audit --no-fund >/dev/null && node tools/jekyll-dev/check-builds.mjs tools/jekyll-dev/out')"
trap 'docker rm -f "$cid" >/dev/null' EXIT
docker cp . "$cid:/repo"
docker start -a "$cid"
61 changes: 51 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
# Readerly

Readerly is a free WordPress block theme for people who love books. It is built for a book blog first, and it also gives you patterns for an author website and a reading log. Each use is optional: the theme creates no pages, posts or categories, and every section can be removed in one click. It comes in two styles, Paper (light) and Lamplight (dark), and bundles its fonts, so it makes no third-party requests.
Readerly is a free theme for people who love books, for WordPress and for Jekyll. It is built for a book blog first, and it also gives you an author website and a reading log. Each use is optional: the theme creates no pages, posts or categories, and every section can be removed. It comes in two styles, Paper (light) and Lamplight (dark), and bundles its fonts, so it makes no third-party requests.

Requires WordPress 6.9 and PHP 7.4. License: GPLv2 or later.
The WordPress theme requires WordPress 6.9 and PHP 7.4, under GPLv2 or later. The Jekyll theme runs on GitHub Pages and Jekyll 4, under the MIT License.

## Layout

| Folder | What it holds |
| --- | --- |
| `design/` | Seven static HTML pages (blog home, review, author, reading log, archive, page, 404) and `tokens.json`. This is the approved visual reference. |
| `wordpress/` | The theme itself. Its contents are what ships; `wordpress/readme.txt` is the WordPress.org readme. |
| `tools/` | The token generator, the checks that CI runs, the zip builder and a local WordPress. None of it ships. |
| `design/` | Seven static HTML pages (blog home, review, author, reading log, archive, page, 404), their CSS, script and fonts, and `tokens.json`. This is the approved visual reference and the source of every generated file. |
| `wordpress/` | The WordPress theme. Its contents are what ships; `wordpress/readme.txt` is the WordPress.org readme. |
| `jekyll/theme/` | The Jekyll theme, published as `listofbooks-net/jekyll-theme-readerly`. |
| `jekyll/starter/` | A ready-to-publish site that uses the theme, published as the template repository `listofbooks-net/jekyll-theme-readerly-starter`. |
| `jekyll/demo/` | The Jekyll demo site, Marginalia, with the design pages' content. |
| `jekyll/fixtures/` | Sites that only the checks build: `bare` (a title and nothing else), `minima` (the output of `jekyll new`) and `sparse` (one post per missing field). |
| `tools/` | The generator, the checks that CI runs, the zip builder, a local WordPress and the Jekyll build images. None of it ships. |

## Design tokens
## Generated files

`design/tokens.json` is the single source for colors, type, spacing and radii. One command writes `design/assets/css/tokens.css`, the palette and presets in `wordpress/theme.json`, and the Lamplight style `wordpress/styles/lamplight.json`:
`design/` is the single source for colors, type, spacing, radii, fonts, CSS and the theme script. One command writes every file derived from it:

- `design/assets/css/tokens.css` and `design/assets/css/fonts.css`
- the palette, presets and font faces in `wordpress/theme.json`, and the Lamplight style `wordpress/styles/lamplight.json`
- `wordpress/assets/fonts/`
- `jekyll/theme/assets/css/readerly.css` (fonts, tokens and `design/assets/css/style.css`), `jekyll/theme/assets/js/theme.js`, and the theme's fonts and images
- the demo's covers and images in `jekyll/demo/assets/`

```sh
node tools/build-tokens.mjs # regenerate
node tools/build-tokens.mjs --check # exit 1 if a generated file is out of date
```

Edit the tokens, rerun the command and commit the generated files. Do not edit those files by hand.
Edit the source in `design/`, rerun the command and commit the generated files. Do not edit those files by hand. The design pages link `design/assets/css/demo.css`, which holds the demo-bar rules that no theme ships.

## Run WordPress locally

Expand All @@ -46,7 +56,38 @@ CI is `.github/workflows/ci.yml`. GitHub Actions is off for this repository, so
act pull_request -W .github/workflows/ci.yml
```

It checks that the tokens are up to date, that `theme.json` and the style files match the WordPress schema (`npm ci --prefix tools && node tools/check-theme-json.mjs`), and that every PHP file passes `php -l` on PHP 7.4 and 8.4.
It checks that the generated files are up to date, that `theme.json` and the style files match the WordPress schema (`npm ci --prefix tools && node tools/check-theme-json.mjs`), that every PHP file passes `php -l` on PHP 7.4 and 8.4, and every Jekyll check in the next section.

## Build and check the Jekyll theme

You need Docker and Node. The script builds two images: `pages`, with the `github-pages` gem that GitHub Pages builds with (Jekyll 3.10, run with `--safe`), and `jekyll4`, with Jekyll 4.4. Both load the theme from `jekyll/theme/` as a local gem, so nothing is downloaded from the published repository.

```sh
tools/jekyll-dev/jekyll-dev.sh images # build the two images, once
tools/jekyll-dev/jekyll-dev.sh build # build every site on both engines into tools/jekyll-dev/out/
tools/jekyll-dev/jekyll-dev.sh serve demo # serve the demo at http://localhost:4000/sub/
```

`build` builds the demo, the starter (once as published, once with its example draft) and the four fixtures, under the baseurl `/sub`. A build that prints anything, warnings included, fails.

To run the checks, install the tools and point `CHROMIUM_PATH` at a Chromium:

```sh
npm ci --prefix tools
CHROMIUM_PATH=/usr/bin/chromium tools/jekyll-dev/jekyll-dev.sh check
```

`check` builds, then runs `tools/jekyll-dev/check-builds.mjs`:

1. Each site's HTML is the same on both engines, whitespace aside.
2. Every internal link and asset resolves to a built file under the baseurl.
3. Every attribute parses, no heading is empty, and each fixture's own cases hold: quotes in titles and authors, the Minima page body, a custom `paginate_path`, an untitled archive and missing titles (`check-markup.mjs`).
4. The demo has the same markup as the seven design pages (`check-parity.mjs`). Each allowed difference is in `parity-exceptions.json` with its reason.
5. Every page of every site passes `tools/wp-dev/check-pages.cjs` at 1280 px and 390 px, in Paper and Lamplight: no overflow, broken images, console errors or third-party requests, one h1, no empty headings or sections, and exactly one footer credit.

To compare the design pages with the demo by eye, run `node tools/jekyll-dev/side-by-side.mjs` after a build. It writes `tools/jekyll-dev/out/side-by-side/index.html`.

`tools/publish-jekyll.sh <version>` pushes a release to the two public repositories: the tag first, then, once the starter builds against that tag, the `v<major>` branch and `main`. Only an operator runs it; see the header of the script.

## Build the zip

Expand All @@ -62,4 +103,4 @@ tools/wp-dev/wp-dev.sh zip-test dist/readerly-1.0.0.zip

## The footer credit

The footer keeps one link, "Theme by List of Books", to https://www.listofbooks.net/. A site owner can edit or delete it in the Site Editor.
The footer keeps one link, "Theme by List of Books", to https://www.listofbooks.net/. In WordPress, a site owner can edit or delete it in the Site Editor. In Jekyll, a site owner removes it by adding an empty `_includes/shell/credit.html`.
5 changes: 2 additions & 3 deletions design/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
<meta name="description" content="This page could not be found.">
<meta name="color-scheme" content="light dark">
<link rel="icon" href="assets/img/favicon.svg" type="image/svg+xml">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..600;1,9..144,300..600&amp;family=Literata:ital,opsz,wght@0,7..72,400..700;1,7..72,400..700&amp;display=swap">
<link rel="stylesheet" href="assets/css/fonts.css">
<link rel="stylesheet" href="assets/css/tokens.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/demo.css">
<script src="assets/js/theme.js"></script>
</head>
<body>
Expand Down
5 changes: 2 additions & 3 deletions design/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
<meta name="description" content="All reviews in the Literary fiction category.">
<meta name="color-scheme" content="light dark">
<link rel="icon" href="assets/img/favicon.svg" type="image/svg+xml">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..600;1,9..144,300..600&amp;family=Literata:ital,opsz,wght@0,7..72,400..700;1,7..72,400..700&amp;display=swap">
<link rel="stylesheet" href="assets/css/fonts.css">
<link rel="stylesheet" href="assets/css/tokens.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/demo.css">
<script src="assets/js/theme.js"></script>
</head>
<body>
Expand Down
42 changes: 42 additions & 0 deletions design/assets/css/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* Demo bar for the reference pages in design/. No port ships this file. */
.demo-bar {
background: var(--color-contrast);
color: var(--color-base);
font-size: var(--size-small);
line-height: 1.4;
}
.demo-bar__inner {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0 var(--space-40);
padding-block: var(--space-20);
}
.demo-bar__label {
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.demo-bar ul {
display: flex;
flex-wrap: wrap;
gap: 0 var(--space-30);
margin: 0;
padding: 0;
list-style: none;
}
.demo-bar li { margin: 0; }
.demo-bar a {
display: inline-block;
padding-block: 0.25rem;
color: var(--color-base);
text-decoration: none;
}
.demo-bar a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.demo-bar a[aria-current="page"] {
font-weight: 600;
text-decoration: underline;
text-decoration-thickness: 2px;
}
.demo-bar :focus-visible { outline-color: var(--color-base); }
76 changes: 76 additions & 0 deletions design/assets/css/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Readerly — bundled fonts, under the SIL Open Font License (OFL.txt beside each font)
* GENERATED from design/tokens.json by tools/build-tokens.mjs. Do not edit.
*/

@font-face {
font-family: "Fraunces";
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("../fonts/fraunces/fraunces-latin-standard-normal.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: "Fraunces";
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("../fonts/fraunces/fraunces-latin-ext-standard-normal.woff2") format("woff2");
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
font-family: "Fraunces";
font-style: italic;
font-weight: 100 900;
font-display: swap;
src: url("../fonts/fraunces/fraunces-latin-standard-italic.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: "Fraunces";
font-style: italic;
font-weight: 100 900;
font-display: swap;
src: url("../fonts/fraunces/fraunces-latin-ext-standard-italic.woff2") format("woff2");
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
font-family: "Literata";
font-style: normal;
font-weight: 200 900;
font-display: swap;
src: url("../fonts/literata/literata-latin-standard-normal.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: "Literata";
font-style: normal;
font-weight: 200 900;
font-display: swap;
src: url("../fonts/literata/literata-latin-ext-standard-normal.woff2") format("woff2");
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
font-family: "Literata";
font-style: italic;
font-weight: 200 900;
font-display: swap;
src: url("../fonts/literata/literata-latin-standard-italic.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: "Literata";
font-style: italic;
font-weight: 200 900;
font-display: swap;
src: url("../fonts/literata/literata-latin-ext-standard-italic.woff2") format("woff2");
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
43 changes: 0 additions & 43 deletions design/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -291,49 +291,6 @@ small, .has-small-font-size { font-size: var(--size-small); }
.site-tools--compact { flex-basis: auto; }
}

/* Demo bar: links between the theme's demo pages, separate from any site's own header */
.demo-bar {
background: var(--color-contrast);
color: var(--color-base);
font-size: var(--size-small);
line-height: 1.4;
}
.demo-bar__inner {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0 var(--space-40);
padding-block: var(--space-20);
}
.demo-bar__label {
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.demo-bar ul {
display: flex;
flex-wrap: wrap;
gap: 0 var(--space-30);
margin: 0;
padding: 0;
list-style: none;
}
.demo-bar li { margin: 0; }
.demo-bar a {
display: inline-block;
padding-block: 0.25rem;
color: var(--color-base);
text-decoration: none;
}
.demo-bar a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.demo-bar a[aria-current="page"] {
font-weight: 600;
text-decoration: underline;
text-decoration-thickness: 2px;
}
.demo-bar :focus-visible { outline-color: var(--color-base); }

/* Site nav wraps instead of scrolling, so no label is ever clipped */
.site-nav ul {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion design/assets/css/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
--color-accent-2: #4a6650; /* status, tags: sage (5.6:1 on base) */
--color-border: #ddd3c3; /* hairlines, dividers (decorative only) */

/* Font families (Google Fonts, SIL Open Font License) */
/* Font families (bundled in assets/fonts, SIL Open Font License) */
--font-heading: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
--font-body: "Literata", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

Expand Down
Loading
Loading