diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a201b25..d7f730a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/README.md b/README.md index ffaf862..b33bd68 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ` pushes a release to the two public repositories: the tag first, then, once the starter builds against that tag, the `v` branch and `main`. Only an operator runs it; see the header of the script. ## Build the zip @@ -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`. diff --git a/design/404.html b/design/404.html index ba4227d..584603a 100644 --- a/design/404.html +++ b/design/404.html @@ -7,11 +7,10 @@ - - - + + diff --git a/design/archive.html b/design/archive.html index 043e4c9..7090759 100644 --- a/design/archive.html +++ b/design/archive.html @@ -7,11 +7,10 @@ - - - + + diff --git a/design/assets/css/demo.css b/design/assets/css/demo.css new file mode 100644 index 0000000..61f9bb5 --- /dev/null +++ b/design/assets/css/demo.css @@ -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); } diff --git a/design/assets/css/fonts.css b/design/assets/css/fonts.css new file mode 100644 index 0000000..3b7e059 --- /dev/null +++ b/design/assets/css/fonts.css @@ -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; +} diff --git a/design/assets/css/style.css b/design/assets/css/style.css index 37c72c4..0daad63 100644 --- a/design/assets/css/style.css +++ b/design/assets/css/style.css @@ -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; diff --git a/design/assets/css/tokens.css b/design/assets/css/tokens.css index 120880f..1549f6b 100644 --- a/design/assets/css/tokens.css +++ b/design/assets/css/tokens.css @@ -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; diff --git a/design/assets/fonts/fraunces/OFL.txt b/design/assets/fonts/fraunces/OFL.txt new file mode 100644 index 0000000..1dd6478 --- /dev/null +++ b/design/assets/fonts/fraunces/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Fraunces Project Authors (github.com/undercasetype/Fraunces) Fraunces-Italic[SOFT,WONK,opsz,wght].ttf: Copyright 2020 The Fraunces Project Authors (github.com/undercasetype/Fraunces) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/design/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 b/design/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 new file mode 100644 index 0000000..2e65049 Binary files /dev/null and b/design/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 differ diff --git a/design/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 b/design/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 new file mode 100644 index 0000000..b6e3e3a Binary files /dev/null and b/design/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 differ diff --git a/design/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 b/design/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 new file mode 100644 index 0000000..b2cf648 Binary files /dev/null and b/design/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 differ diff --git a/design/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 b/design/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 new file mode 100644 index 0000000..cb295bf Binary files /dev/null and b/design/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 differ diff --git a/design/assets/fonts/literata/OFL.txt b/design/assets/fonts/literata/OFL.txt new file mode 100644 index 0000000..5030063 --- /dev/null +++ b/design/assets/fonts/literata/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2017 The Literata Project Authors (https://github.com/googlefonts/literata) Literata-Italic[opsz,wght].ttf: Copyright 2017 The Literata Project Authors (https://github.com/googlefonts/literata) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/design/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 b/design/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 new file mode 100644 index 0000000..4ae2494 Binary files /dev/null and b/design/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 differ diff --git a/design/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 b/design/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 new file mode 100644 index 0000000..1339f9f Binary files /dev/null and b/design/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 differ diff --git a/design/assets/fonts/literata/literata-latin-standard-italic.woff2 b/design/assets/fonts/literata/literata-latin-standard-italic.woff2 new file mode 100644 index 0000000..87975e1 Binary files /dev/null and b/design/assets/fonts/literata/literata-latin-standard-italic.woff2 differ diff --git a/design/assets/fonts/literata/literata-latin-standard-normal.woff2 b/design/assets/fonts/literata/literata-latin-standard-normal.woff2 new file mode 100644 index 0000000..1f3f137 Binary files /dev/null and b/design/assets/fonts/literata/literata-latin-standard-normal.woff2 differ diff --git a/design/author.html b/design/author.html index 7e052a4..181f206 100644 --- a/design/author.html +++ b/design/author.html @@ -7,11 +7,10 @@ - - - + + diff --git a/design/index.html b/design/index.html index 9302d67..f32f5e8 100644 --- a/design/index.html +++ b/design/index.html @@ -7,11 +7,10 @@ - - - + + diff --git a/design/page.html b/design/page.html index c9b0d82..53cba2d 100644 --- a/design/page.html +++ b/design/page.html @@ -7,11 +7,10 @@ - - - + + diff --git a/design/reading-log.html b/design/reading-log.html index 4359628..750847c 100644 --- a/design/reading-log.html +++ b/design/reading-log.html @@ -7,11 +7,10 @@ - - - + + diff --git a/design/review.html b/design/review.html index e070020..a906ba6 100644 --- a/design/review.html +++ b/design/review.html @@ -7,11 +7,10 @@ - - - + + diff --git a/design/tokens.json b/design/tokens.json index 32909f3..89aaadc 100644 --- a/design/tokens.json +++ b/design/tokens.json @@ -1,5 +1,5 @@ { - "$description": "Readerly design tokens. The one source for every port. Edit this file, then run `node tools/build-tokens.mjs` to regenerate design/assets/css/tokens.css, wordpress/theme.json presets and wordpress/styles/lamplight.json.", + "$description": "Readerly design tokens. The one source for every port. Edit this file, then run `node tools/build-tokens.mjs` to regenerate design/assets/css/tokens.css and fonts.css, wordpress/theme.json presets and wordpress/styles/lamplight.json, and the Jekyll theme's stylesheet. The script lists every file it writes.", "modes": { "light": { "title": "Paper" }, "dark": { "title": "Lamplight" } @@ -53,11 +53,23 @@ "fontFamily": { "heading": { "name": "Fraunces", - "stack": "\"Fraunces\", \"Iowan Old Style\", \"Palatino Linotype\", Georgia, serif" + "stack": "\"Fraunces\", \"Iowan Old Style\", \"Palatino Linotype\", Georgia, serif", + "files": "fraunces", + "weight": "100 900" }, "body": { "name": "Literata", - "stack": "\"Literata\", \"Iowan Old Style\", \"Palatino Linotype\", Georgia, serif" + "stack": "\"Literata\", \"Iowan Old Style\", \"Palatino Linotype\", Georgia, serif", + "files": "literata", + "weight": "200 900" + } + }, + "fontFace": { + "$description": "Every family in fontFamily ships one variable woff2 per style and subset, at design/assets/fonts//--standard- + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
diff --git a/jekyll/fixtures/minima/Gemfile b/jekyll/fixtures/minima/Gemfile new file mode 100644 index 0000000..395750a --- /dev/null +++ b/jekyll/fixtures/minima/Gemfile @@ -0,0 +1,33 @@ +source "https://rubygems.org" +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +gem "jekyll", "~> 4.4.1" +# This is the default theme for new Jekyll sites. You may change this to anything you like. +gem "minima", "~> 2.5" +# If you want to use GitHub Pages, remove the "gem "jekyll"" above and +# uncomment the line below. To upgrade, run `bundle update github-pages`. +# gem "github-pages", group: :jekyll_plugins +# If you have any plugins, put them here! +group :jekyll_plugins do + gem "jekyll-feed", "~> 0.12" +end + +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" +end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin] + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem +# do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] diff --git a/jekyll/fixtures/minima/_config.yml b/jekyll/fixtures/minima/_config.yml new file mode 100644 index 0000000..ab0cf74 --- /dev/null +++ b/jekyll/fixtures/minima/_config.yml @@ -0,0 +1,57 @@ +# Welcome to Jekyll! +# +# This config file is meant for settings that affect your whole blog, values +# which you are expected to set up once and rarely edit after that. If you find +# yourself editing this file very often, consider using Jekyll's data files +# feature for the data you need to update frequently. +# +# For technical reasons, this file is *NOT* reloaded automatically when you use +# 'bundle exec jekyll serve'. If you change this file, please restart the server process. +# +# If you need help with YAML syntax, here are some quick references for you: +# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml +# https://learnxinyminutes.com/docs/yaml/ +# +# Site settings +# These are used to personalize your new site. If you look in the HTML files, +# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. +# You can create any custom variable you would like, and they will be accessible +# in the templates via {{ site.myvariable }}. + +title: Your awesome title +email: your-email@example.com +description: >- # this means to ignore newlines until "baseurl:" + Write an awesome description for your new site here. You can edit this + line in _config.yml. It will appear in your document head meta (for + Google search results) and in your feed.xml site description. +baseurl: "" # the subpath of your site, e.g. /blog +url: "" # the base hostname & protocol for your site, e.g. http://example.com +twitter_username: jekyllrb +github_username: jekyll + +# Build settings +# Changed from the jekyll new output: these three lines replace "theme: minima". +remote_theme: listofbooks-net/jekyll-theme-readerly@v1 +plugins: + - jekyll-remote-theme + - jekyll-feed + +# Exclude from processing. +# The following items will not be processed, by default. +# Any item listed under the `exclude:` key here will be automatically added to +# the internal "default list". +# +# Excluded items can be processed by explicitly listing the directories or +# their entries' file path in the `include:` list. +# +# exclude: +# - .sass-cache/ +# - .jekyll-cache/ +# - gemfiles/ +# - Gemfile +# - Gemfile.lock +# - node_modules/ +# - vendor/bundle/ +# - vendor/cache/ +# - vendor/gems/ +# - vendor/ruby/ diff --git a/jekyll/fixtures/minima/_posts/2026-11-01-welcome-to-jekyll.markdown b/jekyll/fixtures/minima/_posts/2026-11-01-welcome-to-jekyll.markdown new file mode 100644 index 0000000..4a1777c --- /dev/null +++ b/jekyll/fixtures/minima/_posts/2026-11-01-welcome-to-jekyll.markdown @@ -0,0 +1,29 @@ +--- +layout: post +title: "Welcome to Jekyll!" +date: 2026-11-01 09:00:00 +0000 +categories: jekyll update +--- +You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. + +Jekyll requires blog post files to be named according to the following format: + +`YEAR-MONTH-DAY-title.MARKUP` + +Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works. + +Jekyll also offers powerful support for code snippets: + +{% highlight ruby %} +def print_hi(name) + puts "Hi, #{name}" +end +print_hi('Tom') +#=> prints 'Hi, Tom' to STDOUT. +{% endhighlight %} + +Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk]. + +[jekyll-docs]: https://jekyllrb.com/docs/home +[jekyll-gh]: https://github.com/jekyll/jekyll +[jekyll-talk]: https://talk.jekyllrb.com/ diff --git a/jekyll/fixtures/minima/about.markdown b/jekyll/fixtures/minima/about.markdown new file mode 100644 index 0000000..8b4e0b2 --- /dev/null +++ b/jekyll/fixtures/minima/about.markdown @@ -0,0 +1,18 @@ +--- +layout: page +title: About +permalink: /about/ +--- + +This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/) + +You can find the source code for Minima at GitHub: +[jekyll][jekyll-organization] / +[minima](https://github.com/jekyll/minima) + +You can find the source code for Jekyll at GitHub: +[jekyll][jekyll-organization] / +[jekyll](https://github.com/jekyll/jekyll) + + +[jekyll-organization]: https://github.com/jekyll diff --git a/jekyll/fixtures/minima/index.markdown b/jekyll/fixtures/minima/index.markdown new file mode 100644 index 0000000..f6cec34 --- /dev/null +++ b/jekyll/fixtures/minima/index.markdown @@ -0,0 +1,8 @@ +--- +# Feel free to add content and custom Front Matter to this file. +# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults + +layout: home +--- + +This body text belongs to the page, so the home layout must print it. diff --git a/jekyll/fixtures/paginated/_config.yml b/jekyll/fixtures/paginated/_config.yml new file mode 100644 index 0000000..7497963 --- /dev/null +++ b/jekyll/fixtures/paginated/_config.yml @@ -0,0 +1,16 @@ +# A custom paginate_path (the pager's first link must be /blog/) and an archive page +# with no title (its heading must not be empty). +title: Paginated +baseurl: /sub +remote_theme: listofbooks-net/jekyll-theme-readerly@v1 +plugins: + - jekyll-remote-theme + - jekyll-paginate +paginate: 2 +paginate_path: /blog/page:num/ +liquid: + error_mode: strict + strict_filters: true +defaults: + - scope: { type: posts } + values: { layout: post } diff --git a/jekyll/fixtures/paginated/_posts/2026-10-01-review-1.md b/jekyll/fixtures/paginated/_posts/2026-10-01-review-1.md new file mode 100644 index 0000000..935a859 --- /dev/null +++ b/jekyll/fixtures/paginated/_posts/2026-10-01-review-1.md @@ -0,0 +1,7 @@ +--- +title: Review number 1 +book_author: Author 1 +genre: Essays +rating: 4 +--- +Body 1. diff --git a/jekyll/fixtures/paginated/_posts/2026-10-02-review-2.md b/jekyll/fixtures/paginated/_posts/2026-10-02-review-2.md new file mode 100644 index 0000000..7f47742 --- /dev/null +++ b/jekyll/fixtures/paginated/_posts/2026-10-02-review-2.md @@ -0,0 +1,7 @@ +--- +title: Review number 2 +book_author: Author 2 +genre: Essays +rating: 4 +--- +Body 2. diff --git a/jekyll/fixtures/paginated/_posts/2026-10-03-review-3.md b/jekyll/fixtures/paginated/_posts/2026-10-03-review-3.md new file mode 100644 index 0000000..dc8caaf --- /dev/null +++ b/jekyll/fixtures/paginated/_posts/2026-10-03-review-3.md @@ -0,0 +1,7 @@ +--- +title: Review number 3 +book_author: Author 3 +genre: Essays +rating: 4 +--- +Body 3. diff --git a/jekyll/fixtures/paginated/_posts/2026-10-04-review-4.md b/jekyll/fixtures/paginated/_posts/2026-10-04-review-4.md new file mode 100644 index 0000000..632424c --- /dev/null +++ b/jekyll/fixtures/paginated/_posts/2026-10-04-review-4.md @@ -0,0 +1,7 @@ +--- +title: Review number 4 +book_author: Author 4 +genre: Essays +rating: 4 +--- +Body 4. diff --git a/jekyll/fixtures/paginated/_posts/2026-10-05-review-5.md b/jekyll/fixtures/paginated/_posts/2026-10-05-review-5.md new file mode 100644 index 0000000..24575ff --- /dev/null +++ b/jekyll/fixtures/paginated/_posts/2026-10-05-review-5.md @@ -0,0 +1,7 @@ +--- +title: Review number 5 +book_author: Author 5 +genre: Essays +rating: 4 +--- +Body 5. diff --git a/jekyll/fixtures/paginated/blog/index.html b/jekyll/fixtures/paginated/blog/index.html new file mode 100644 index 0000000..3ad816e --- /dev/null +++ b/jekyll/fixtures/paginated/blog/index.html @@ -0,0 +1,6 @@ +--- +layout: home +intro: + heading: The blog +sections: [intro, recent-reviews] +--- diff --git a/jekyll/fixtures/paginated/index.md b/jekyll/fixtures/paginated/index.md new file mode 100644 index 0000000..f99938e --- /dev/null +++ b/jekyll/fixtures/paginated/index.md @@ -0,0 +1,5 @@ +--- +layout: page +title: Paginated +--- +The reviews are at [the blog]({{ "/blog/" | relative_url }}). diff --git a/jekyll/fixtures/paginated/reviews.md b/jekyll/fixtures/paginated/reviews.md new file mode 100644 index 0000000..50ecc36 --- /dev/null +++ b/jekyll/fixtures/paginated/reviews.md @@ -0,0 +1,4 @@ +--- +layout: archive +permalink: /reviews/ +--- diff --git a/jekyll/fixtures/sparse/_config.yml b/jekyll/fixtures/sparse/_config.yml new file mode 100644 index 0000000..88763cb --- /dev/null +++ b/jekyll/fixtures/sparse/_config.yml @@ -0,0 +1,19 @@ +# One post per row of the theme's "when it is missing" table, under a baseurl. +# No author, nav, footer, newsletter, archive page, books or praise. +title: Sparse +baseurl: /sub +permalink: /:title/ +remote_theme: listofbooks-net/jekyll-theme-readerly@v1 +plugins: + - jekyll-remote-theme +liquid: + error_mode: strict + strict_filters: true +# GitHub Pages gives posts the post layout through jekyll-default-layout. +# Jekyll 4 has no such plugin, so the fixture sets it for both. +defaults: + - scope: { type: posts } + values: { layout: post } +# A protocol-relative URL, which the theme must leave as written. +readerly: + favicon: //example.com/favicon.svg diff --git a/jekyll/fixtures/sparse/_data/books.yml b/jekyll/fixtures/sparse/_data/books.yml new file mode 100644 index 0000000..ba0e4a8 --- /dev/null +++ b/jekyll/fixtures/sparse/_data/books.yml @@ -0,0 +1,2 @@ +- featured: true + blurb: A featured book with no title, which the new-release section skips. diff --git a/jekyll/fixtures/sparse/_data/events.yml b/jekyll/fixtures/sparse/_data/events.yml new file mode 100644 index 0000000..ff12828 --- /dev/null +++ b/jekyll/fixtures/sparse/_data/events.yml @@ -0,0 +1,5 @@ +# Only a past event, so the events section prints nothing. +- title: A reading that already happened + date: 2020-01-01 +- where: An upcoming event with no title, which is skipped + date: 2099-01-01 diff --git a/jekyll/fixtures/sparse/_posts/2026-10-01-no-cover.md b/jekyll/fixtures/sparse/_posts/2026-10-01-no-cover.md new file mode 100644 index 0000000..39ba032 --- /dev/null +++ b/jekyll/fixtures/sparse/_posts/2026-10-01-no-cover.md @@ -0,0 +1,10 @@ +--- +title: A Book With No Cover +book_author: Ada Lin +genre: Fantasy +rating: 3 +status: read +finished: 2026-09-28 +excerpt: The card shows a typeset cover with the title and author. +--- +No `cover` key, so every card and the book panel show the typeset placeholder. diff --git a/jekyll/fixtures/sparse/_posts/2026-10-02-no-rating.md b/jekyll/fixtures/sparse/_posts/2026-10-02-no-rating.md new file mode 100644 index 0000000..f517b21 --- /dev/null +++ b/jekyll/fixtures/sparse/_posts/2026-10-02-no-rating.md @@ -0,0 +1,7 @@ +--- +title: A Book With No Rating +book_author: Ben Ola +genre: Fantasy +status: read +--- +No `rating`, so no stars, and no `finished`, so it sorts last on the Read shelf. diff --git a/jekyll/fixtures/sparse/_posts/2026-10-03-no-genre.md b/jekyll/fixtures/sparse/_posts/2026-10-03-no-genre.md new file mode 100644 index 0000000..500af15 --- /dev/null +++ b/jekyll/fixtures/sparse/_posts/2026-10-03-no-genre.md @@ -0,0 +1,7 @@ +--- +title: A Book With No Genre +book_author: Cora Pike +rating: 4 +pages: 200 +--- +No `genre`: no label above the title, no genre list entry and no related posts. diff --git a/jekyll/fixtures/sparse/_posts/2026-10-04-plain-article.md b/jekyll/fixtures/sparse/_posts/2026-10-04-plain-article.md new file mode 100644 index 0000000..6ee79b7 --- /dev/null +++ b/jekyll/fixtures/sparse/_posts/2026-10-04-plain-article.md @@ -0,0 +1,4 @@ +--- +title: A plain blog post +--- +No book keys at all, so there is no book panel and the post is an ordinary article. diff --git a/jekyll/fixtures/sparse/_posts/2026-10-05-unknown-status.md b/jekyll/fixtures/sparse/_posts/2026-10-05-unknown-status.md new file mode 100644 index 0000000..ba9872e --- /dev/null +++ b/jekyll/fixtures/sparse/_posts/2026-10-05-unknown-status.md @@ -0,0 +1,9 @@ +--- +title: A Book With An Unknown Status +book_author: Dev Rao +genre: Essays +status: abandoned +verdict: + summary: A verdict with a summary and no lists. +--- +An unknown `status` puts the book on no shelf and shows no badge. diff --git a/jekyll/fixtures/sparse/_posts/2026-10-06-reading-no-pages.md b/jekyll/fixtures/sparse/_posts/2026-10-06-reading-no-pages.md new file mode 100644 index 0000000..26242fa --- /dev/null +++ b/jekyll/fixtures/sparse/_posts/2026-10-06-reading-no-pages.md @@ -0,0 +1,7 @@ +--- +title: A Book I Am Reading +book_author: Eli Moss +status: reading +current_page: 40 +--- +`status: reading` with no `pages`, so the card has a badge and no progress bar. diff --git a/jekyll/fixtures/sparse/_posts/2026-10-07-quoted-title.md b/jekyll/fixtures/sparse/_posts/2026-10-07-quoted-title.md new file mode 100644 index 0000000..a9eec5a --- /dev/null +++ b/jekyll/fixtures/sparse/_posts/2026-10-07-quoted-title.md @@ -0,0 +1,10 @@ +--- +title: The "Quiet" Arithmetic +book_author: Ann "Ace" O'Neil +genre: Essays +rating: 4 +pages: 200 +status: reading +current_page: 50 +--- +A title and an author with double quotes, and an author name that contains , which must not end the JSON-LD block. diff --git a/jekyll/fixtures/sparse/author.md b/jekyll/fixtures/sparse/author.md new file mode 100644 index 0000000..85814b9 --- /dev/null +++ b/jekyll/fixtures/sparse/author.md @@ -0,0 +1,4 @@ +--- +layout: author +title: An Author With "No" Books +--- diff --git a/jekyll/fixtures/sparse/index.html b/jekyll/fixtures/sparse/index.html new file mode 100644 index 0000000..e4d427d --- /dev/null +++ b/jekyll/fixtures/sparse/index.html @@ -0,0 +1,3 @@ +--- +layout: home +--- diff --git a/jekyll/fixtures/sparse/reading-log.md b/jekyll/fixtures/sparse/reading-log.md new file mode 100644 index 0000000..3ff2948 --- /dev/null +++ b/jekyll/fixtures/sparse/reading-log.md @@ -0,0 +1,5 @@ +--- +layout: reading-log +title: Reading log +year: 2025 +--- diff --git a/jekyll/starter/.gitignore b/jekyll/starter/.gitignore new file mode 100644 index 0000000..cfce9ed --- /dev/null +++ b/jekyll/starter/.gitignore @@ -0,0 +1,4 @@ +_site/ +.jekyll-cache/ +.sass-cache/ +Gemfile.lock diff --git a/jekyll/starter/404.html b/jekyll/starter/404.html new file mode 100644 index 0000000..6113d93 --- /dev/null +++ b/jekyll/starter/404.html @@ -0,0 +1,5 @@ +--- +layout: not-found +title: Page not found +permalink: /404.html +--- diff --git a/jekyll/starter/Gemfile b/jekyll/starter/Gemfile new file mode 100644 index 0000000..b41a517 --- /dev/null +++ b/jekyll/starter/Gemfile @@ -0,0 +1,6 @@ +# Only needed to preview the site on your own computer (bundle exec jekyll serve). +# GitHub Pages ignores this file. +source "https://rubygems.org" + +gem "github-pages", group: :jekyll_plugins +gem "webrick" diff --git a/jekyll/starter/LICENSE b/jekyll/starter/LICENSE new file mode 100644 index 0000000..12f60b3 --- /dev/null +++ b/jekyll/starter/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 List of Books + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/jekyll/starter/README.md b/jekyll/starter/README.md new file mode 100644 index 0000000..4e77538 --- /dev/null +++ b/jekyll/starter/README.md @@ -0,0 +1,45 @@ +# My book notes + +This site uses [Readerly](https://github.com/listofbooks-net/jekyll-theme-readerly), a free Jekyll theme for book blogs, author sites and reading logs. It runs on GitHub Pages. + +## Publish the site + +1. Click **Use this template** to create your own copy of this repository. +2. In your copy, open **Settings > Pages**, set **Source** to **Deploy from a branch**, and pick `main`. +3. Edit `_config.yml`: set `title`, `tagline` and `description`, then commit. + +After a minute or two, the site is live at the address that **Settings > Pages** shows. + +## Write a review + +1. Copy `_drafts/example-review.md` to `_posts/`, and name the copy with the date and title, for example `_posts/2026-11-04-the-salt-orchard.md`. +2. Fill in the front matter. Delete any line you do not need: that part of the page disappears. +3. Replace the example text with your review, then commit. + +Jekyll does not publish files in `_drafts`, so the example never appears on your site. + +## Add more pages + +The theme creates no pages for you. Each page below is a file you add when you want it: + +- A reading log: `reading-log.md` with `layout: reading-log`. +- An author page for your own books: a page with `layout: author`. +- An archive with search: `reviews.md` with `layout: archive`. +- An about page: `about.md` with `layout: page`. + +The [theme README](https://github.com/listofbooks-net/jekyll-theme-readerly#readme) shows the front matter for each, and every setting `_config.yml` accepts. + +## Preview on your computer + +You need Ruby and Bundler. Run: + +```sh +bundle install +bundle exec jekyll serve +``` + +The site opens at http://localhost:4000. + +## The footer credit + +Each page ends with one link, "Theme by List of Books". To remove it, create an empty file at `_includes/shell/credit.html`. diff --git a/jekyll/starter/_config.yml b/jekyll/starter/_config.yml new file mode 100644 index 0000000..58c407a --- /dev/null +++ b/jekyll/starter/_config.yml @@ -0,0 +1,42 @@ +# Site settings. Edit these, commit, and GitHub Pages rebuilds the site. +title: My book notes +tagline: Reviews of the books I read +description: Honest reviews of the books I read. +lang: en + +# Leave these two as they are: they load the Readerly theme. +remote_theme: listofbooks-net/jekyll-theme-readerly@v1 +plugins: + - jekyll-remote-theme + - jekyll-paginate + - jekyll-feed + +# Reviews live at // and the home page shows nine per page. +permalink: /:title/ +paginate: 9 + +# Who writes the reviews. Uncomment and fill in to show a byline and a bio +# card under each review. +# author: +# name: Your Name +# avatar: /assets/img/me.jpg +# bio: One or two sentences about you and what you read. +# url: /about/ + +# Every Readerly setting is optional. The theme README lists them all. +readerly: + style: auto # auto (follows the visitor's system), paper or lamplight + style_toggle: true # show the light/dark button in the header + # nav: + # - { title: Reviews, url: / } + # - { title: About, url: /about/ } + # footer: + # about: A sentence about this site. + # copyright: All reviews are my own. + # newsletter: + # action: https://example.com/your-signup-form-url + # heading: Get new reviews by email. + +exclude: + - README.md + - LICENSE diff --git a/jekyll/starter/_drafts/example-review.md b/jekyll/starter/_drafts/example-review.md new file mode 100644 index 0000000..d0a5b33 --- /dev/null +++ b/jekyll/starter/_drafts/example-review.md @@ -0,0 +1,25 @@ +--- +# An example review. Jekyll does not publish files in _drafts, so this one never +# appears on your site. Copy it to _posts/YYYY-MM-DD-title.md to start a review. +# Every key except title is optional: delete a line and that part disappears. +layout: post +title: The Example Book +lead: One sentence that sums up the book, shown under the title. +book_author: A. N. Author +# cover: /assets/img/example.jpg # a 2:3 image in your repo; without one a typeset cover shows +genre: Literary fiction # one genre: the label above the title and the genre list +tags: [Debut, Translated] # extra chips next to the genre +rating: 4.5 # 0 to 5, halves allowed +series: The Example Trilogy, Book 1 of 3 +pages: 320 +publication: 2026, Example Press +status: read # reading, read, want or dnf: puts the book on the reading log +finished: 2026-10-30 # orders the Read shelf and counts it in that year's statistics +featured: true # the newest featured review fills the big card on the home page +excerpt: Two or three sentences for the review cards on the home page and in the archive. +verdict: + summary: A one-line verdict. + liked: [Something that worked, Another thing] + disliked: [Something that didn't] +--- +Write the review here, in Markdown. diff --git a/jekyll/starter/index.html b/jekyll/starter/index.html new file mode 100644 index 0000000..e4d427d --- /dev/null +++ b/jekyll/starter/index.html @@ -0,0 +1,3 @@ +--- +layout: home +--- diff --git a/jekyll/theme/LICENSE b/jekyll/theme/LICENSE new file mode 100644 index 0000000..79e7e12 --- /dev/null +++ b/jekyll/theme/LICENSE @@ -0,0 +1,24 @@ +MIT License + +Copyright (c) 2026 List of Books + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +The fonts in assets/fonts are licensed separately under the SIL Open Font +License 1.1; each font folder holds its OFL.txt. diff --git a/jekyll/theme/README.md b/jekyll/theme/README.md new file mode 100644 index 0000000..7605bcf --- /dev/null +++ b/jekyll/theme/README.md @@ -0,0 +1,305 @@ +# Readerly + +Readerly is a free Jekyll theme for book blogs, author sites and reading logs. It runs on GitHub Pages with no plugins beyond the ones Pages already allows. + +- Review posts with a cover, star rating, book details and a verdict box. +- A reading log with yearly statistics and shelves for Reading, Read, Want to read and Did not finish. +- An author page for your own books, praise and upcoming events. +- Two styles, Paper (light) and Lamplight (dark), that follow the visitor's system setting. +- Bundled fonts and no third-party requests. + +Every part is optional. The theme creates no posts or pages, and a section with no data prints nothing, heading included. + +## Install + +### Start a new site on GitHub Pages + +1. Open [the Readerly starter repository](https://github.com/listofbooks-net/jekyll-theme-readerly-starter) and click **Use this template**. +2. In your new repository, open **Settings > Pages**, set **Source** to **Deploy from a branch**, and pick `main`. +3. Edit `_config.yml`: set `title`, `tagline` and `description`. +4. Write your first review in `_posts/`. The starter's `_drafts/example-review.md` shows every field. + +GitHub Pages rebuilds the site each time you push. + +### Add the theme to an existing site + +Add two lines to `_config.yml`: + +```yaml +remote_theme: listofbooks-net/jekyll-theme-readerly@v1 +plugins: + - jekyll-remote-theme +``` + +Remove any `theme:` line. Readerly uses the layout names `default`, `home`, `page` and `post`, the same names Minima uses, so existing posts and pages render without changes. + +`@v1` follows every backward-compatible release. To stay on one exact release, use a tag such as `@v1.0.0` instead. + +To show nine reviews per page on the home page, also add `jekyll-paginate` to `plugins`, set `paginate: 9`, and name the home page `index.html` (jekyll-paginate does not paginate `index.md`). + +### Preview on your computer + +Run `bundle exec jekyll serve` in your site. If your Gemfile uses the `github-pages` gem and `_config.yml` has no `description:`, the local build asks the GitHub API for your repository's description, and it can stop with an error when it cannot reach it. Add a `description:` line to `_config.yml`, which also sets your pages' meta description. + +## Write a review + +A review is an ordinary post with extra front matter. Every key except `title` is optional. Delete a key and the part it fills disappears. A post with none of the book keys renders as a plain article. + +```yaml +--- +layout: post +title: The Salt Orchard +lead: A novel about grief that keeps its accounts in apples. +book_author: Mira Hollis +cover: /assets/covers/salt-orchard.jpg +genre: Literary fiction +tags: [Historical, Tidewater series] +rating: 4.5 +series: The Tidewater Books, Book 2 of 3 +pages: 384 +publication: 2026, Harrow & Lane +status: read +finished: 2026-10-30 +excerpt: A grieving fruit scientist inherits a failing orchard on a salt-burned coast. +verdict: + summary: Patient, precise and quietly devastating. + liked: [The orchard as a living clock, Danny Aske] + disliked: [A too-tidy answer to the ledger mystery] +--- +The review, in Markdown. +``` + +### Book entry keys + +Review posts and the entries in `_data/reading_log.yml` share these keys. + +| Key | Type | What it does | When it is missing | +| --- | --- | --- | --- | +| `title` | text | The post headline, and the book title unless `book_title` is set. | Required. | +| `book_title` | text | The book's title, when the headline differs from it. | The title is `title`. | +| `book_author` | text | The book's author. `author` stays free for the person who wrote the post. | No "by" line. | +| `cover` | path or URL | A cover image, ideally 2:3. | A typeset cover with the title and author. | +| `genre` | text | One genre. Fills the label above the title, the genre list and "You might also like". | No label, and the post is not in the genre list. | +| `tags` | list | More labels, shown as chips next to the genre. | Only the genre chip. | +| `rating` | number, 0 to 5 | Stars. Halves are allowed. | No stars anywhere, and no average rating stat. | +| `series` | text | Shown in the book panel and the featured card. | That row is left out. | +| `pages` | number | Page count. Counts toward "Pages read" and the progress bar. | That row is left out. | +| `publication` | text | Publication details, such as `2026, Harrow & Lane`. | That row is left out. | +| `status` | `reading`, `read`, `want` or `dnf` | Puts the book on a reading-log shelf and shows a badge. | On no shelf, and no badge. | +| `finished` | date | Orders the Read shelf and counts the book in that year's statistics. | Last on the Read shelf, and not in a year-scoped log. | +| `current_page` | number | With `pages`, a progress bar for `reading` and "Stopped at page N" for `dnf`. | No progress bar. | +| `url` | path or URL | A link for a reading-log entry. Posts have their own URL. | The card has no link. | + +These keys apply to posts only: + +| Key | What it does | +| --- | --- | +| `lead` | A subtitle under the headline. | +| `excerpt` | The text on review cards. Without it, Jekyll uses the post's first paragraph. | +| `featured` | `true` puts the post in the large card on the home page. Without any featured post, the newest post fills it. | +| `verdict` | `summary`, `liked` and `disliked`, shown in a box after the review. | + +If a post has `rating` and `book_author`, its page carries schema.org `Review` data for search engines. + +## Keep a reading log + +Create `reading-log.md`: + +```yaml +--- +layout: reading-log +title: Reading log +year: 2026 +intro: + eyebrow: Reading journal + heading: What I'm reading in 2026 +--- +``` + +The log shows every review with a `status`, plus the books in `_data/reading_log.yml`. A book you reviewed needs no entry there. List the books you have not reviewed, with the same keys as a review: + +```yaml +- title: Moth Season + book_author: Pell Ordway + status: reading + pages: 368 + current_page: 142 +- title: The Ninth Wave Hotel + book_author: Bea Lindqvist + status: want +``` + +`year` limits the statistics and the Read shelf to the books finished that year. Without `year`, they cover every book. + +## Build an author page + +Create a page with `layout: author` and fill three data files: `_data/books.yml` for your own books, `_data/praise.yml` for quotes, and `_data/events.yml` for readings and signings. + +```yaml +--- +layout: author +title: Isobel Thorne +hero: + eyebrow: Novelist + portrait: /assets/img/isobel.jpg + lead: I write novels about small towns and old trades. + buttons: + - { title: Discover The Bell Foundry, url: "#new-release" } +--- +``` + +| File | Keys | +| --- | --- | +| `_data/books.yml` | `title`, `cover`, `year`, `kind`, `blurb`, `buy_url`, `url`. The first book with `featured: true` also fills the new-release band, which reads `label`, `lead`, `facts`, `url_label` and `where_to_buy` (a list). | +| `_data/praise.yml` | `quote`, `source`, `context`. The theme adds the quotation marks. | +| `_data/events.yml` | `title`, `date`, `where`, `url`, `label`. Events dated before the build are left out. | + +## Choose and order sections + +The `home`, `author` and `reading-log` layouts are lists of sections. To remove a section, reorder sections, or use one on another page, set `sections` in the page's front matter: + +```yaml +--- +layout: home +sections: [intro, recent-reviews, genres] +--- +``` + +A misspelt name stops the build with an error that names the missing file. + +| Layout | Default sections | +| --- | --- | +| `home` | `intro`, `content`, `featured-review`, `recent-reviews`, `currently-reading`, `genres`, `newsletter` | +| `author` | `author-hero`, `new-release`, `books`, `praise`, `events`, `newsletter` | +| `reading-log` | `intro-stats`, `currently-reading`, `shelves` | + +Any page can use `layout: sections` with its own list. These are all the sections: + +| Section | Shows | Page keys it reads | +| --- | --- | --- | +| `intro` | A heading with an eyebrow, lead and buttons. | `intro: {eyebrow, heading, lead, buttons}`. The heading accepts Markdown, so `*past midnight*` is set in italics. | +| `intro-stats` | `intro` with the reading statistics under it. | `intro`, `year` | +| `featured-review` | The newest featured post, else the newest post. | None | +| `recent-reviews` | A grid of reviews, with pagination when jekyll-paginate runs. | None | +| `currently-reading` | Books with `status: reading`. | `currently-reading: {heading, note}` | +| `genres` | Each genre with its number of reviews. | `genres: {heading, note}` | +| `newsletter` | A sign-up form. | `newsletter`, which overrides any `readerly.newsletter` key | +| `author-hero` | The author's portrait and introduction. | `hero: {eyebrow, portrait, lead, text, buttons}` | +| `new-release` | The featured book from `_data/books.yml`. | None | +| `books` | Every book in `_data/books.yml`. | `books: {heading, note}` | +| `praise` | Quotes from `_data/praise.yml`. | `praise: {heading, note}` | +| `events` | Upcoming events from `_data/events.yml`. | `events: {heading, note}` | +| `shelves` | The Read, Want to read and Did not finish shelves. | `year`, and `shelves: {read, want, dnf}`, where each takes `{note}` or `false` to hide that shelf | +| `content` | The page's own Markdown. | None | + +On page 2 and later of the home page, only `recent-reviews` shows. + +## Add an archive and search + +Create a page with `layout: archive`. It lists every review, newest first, and turns on the search box in the header and on the 404 page. Without such a page, the site has no search box and genre names are plain text. + +```yaml +--- +layout: archive +title: All reviews +permalink: /reviews/ +--- +``` + +For a page per genre, create one more archive page with a `genre` key. It lists the reviews whose `genre` or `tags` contain that name, and every link to that genre goes to it. Genres without their own page link to the main archive, filtered in the browser. + +```yaml +--- +layout: archive +title: Literary fiction +genre: Literary fiction +lead: Novels where not much happens and everything changes. +--- +``` + +Search runs in the visitor's browser over the archive page, with no index file and no external service. + +## Configure the site + +Readerly reads the standard Jekyll keys `title`, `description`, `lang`, `author`, `paginate` and `permalink`, plus `tagline`. Theme settings go under `readerly`. Every key is optional. + +```yaml +title: Marginalia +tagline: Book notes & reviews by Nora Vale +author: + name: Nora Vale + avatar: /assets/img/nora.jpg + bio: Former school librarian who reads about sixty books a year. + url: /about/ + +readerly: + style: auto + style_toggle: true + nav: + - { title: Reviews, url: / } + - { title: Reading log, url: /reading-log/ } + footer: + about: Slow, honest reviews of novels, essays and poetry. + columns: + - title: Browse + links: [{ title: Reviews, url: / }, { title: About, url: /about/ }] + copyright: All reviews are my own. + newsletter: + action: https://buttondown.com/api/emails/embed-subscribe/you + heading: One email a month. +``` + +| Key | Default | What it does | +| --- | --- | --- | +| `tagline` | none | The line under the site title. | +| `author` | none | `name`, `avatar`, `bio`, `url` and `links` (a list of `{title, url}`). With `name` and `bio`, each post ends with a bio card. | +| `readerly.style` | `auto` | `auto` follows the visitor's system setting. `paper` and `lamplight` fix one style. | +| `readerly.style_toggle` | `true` | Shows the light and dark button in the header. `false` also removes the theme's script from every page. | +| `readerly.nav` | none | Header links, a list of `{title, url}`. | +| `readerly.footer` | none | `about`, `columns` (each `{title, links}`) and `copyright`. | +| `readerly.newsletter` | none | `action` (the form's URL) turns the newsletter band on. Also `eyebrow`, `heading`, `note`, `button`, and `field` (the email field's name, default `email`). | +| `readerly.related_posts` | `3` | How many posts "You might also like" shows. `0` turns it off. | +| `readerly.date_format` | `%-d %B %Y` | A Liquid date format. | +| `readerly.favicon` | none | The site icon. | +| `readerly.custom_css` | none | A stylesheet loaded after the theme's. | +| `readerly.thousands` | `,` | The thousands separator in statistics. | + +If `plugins` lists `jekyll-feed`, every page links the feed. + +## Change colours and fonts + +The theme's colours, fonts and spacing are CSS custom properties. To change them, add a stylesheet and name it in `readerly.custom_css`: + +```css +:root { --color-accent: #1d4ed8; } +``` + +The full list is at the top of `assets/css/readerly.css`. + +## Translate the interface + +Every interface string has an English default. To replace one, add `_data/readerly_strings.yml` with the keys you want to change. `%n` stands for a number or a name. + +```yaml +recent_reviews: Neueste Rezensionen +by: von %n +``` + +The keys and their defaults are in `_includes/data/t.html`. + +## Add comments or analytics + +Readerly makes no third-party requests. To add a comment system or analytics, create one of these files in your site: + +- `_includes/comments.html` is printed at the end of each post. +- `_includes/head-custom.html` is printed at the end of `<head>`. + +## The footer credit + +Each page ends with one link, "Theme by List of Books", to https://www.listofbooks.net/. Keeping it is how you thank us for the theme. To remove it, create an empty file at `_includes/shell/credit.html` in your site. + +## License + +The theme is released under the MIT License. The bundled fonts, Fraunces and Literata, are under the SIL Open Font License 1.1, and each font folder holds its license text. + +This repository is a read-only copy of the `jekyll/theme` folder of [listofbooks-net/readerly-theme](https://github.com/listofbooks-net/readerly-theme), where the design and the WordPress version also live. Open issues here or there. Send changes to the monorepo. diff --git a/jekyll/theme/_includes/comments.html b/jekyll/theme/_includes/comments.html new file mode 100644 index 0000000..e69de29 diff --git a/jekyll/theme/_includes/components/badge.html b/jekyll/theme/_includes/components/badge.html new file mode 100644 index 0000000..5cc1d17 --- /dev/null +++ b/jekyll/theme/_includes/components/badge.html @@ -0,0 +1,7 @@ +{%- comment -%} The status badge for include.status. Prints nothing for an unknown status. {%- endcomment -%} +{%- case include.status -%} +{%- when "reading" -%}<span class="badge badge--reading">{% include data/t.html key="status_reading" %}</span> +{%- when "read" -%}<span class="badge badge--read">{% include data/t.html key="status_read" %}</span> +{%- when "want" -%}<span class="badge badge--want">{% include data/t.html key="status_want" %}</span> +{%- when "dnf" -%}<span class="badge badge--dnf"><abbr title="{% include data/t.html key="status_dnf" %}">{% include data/t.html key="status_dnf_short" %}</abbr></span> +{%- endcase -%} diff --git a/jekyll/theme/_includes/components/book-card.html b/jekyll/theme/_includes/components/book-card.html new file mode 100644 index 0000000..eb8bb9c --- /dev/null +++ b/jekyll/theme/_includes/components/book-card.html @@ -0,0 +1,96 @@ +{%- comment -%} +One book card. Every card on every page comes from here, and every degrade rule +for cards lives here. + include.entry a review post, a reading-log entry or an own book (_data/books.yml) + include.variant "grid" (default), "list", "compact" or "own" + include.excerpt "clamp", "full" or empty for none (grid and list) + include.heading "h2" or "h3" (default) +{%- endcomment -%} +{%- assign card = include.entry -%} +{%- assign card_variant = include.variant | default: "grid" -%} +{%- assign card_heading = include.heading | default: "h3" -%} +{%- assign card_title = card.book_title | default: card.title -%} +{%- capture card_href %}{% if card.url %}{% include components/url.html url=card.url %}{% endif %}{% endcapture -%} +{%- capture card_cover -%} +{%- if card.cover == nil and card.book_author == nil and card.rating == nil and card.status == nil and include.variant != "own" -%} +{%- comment -%} A plain blog post is not a book, so it gets no placeholder cover. {%- endcomment -%} +{%- elsif card_href != "" -%} +<a class="cover-link book-card__cover" href="{{ card_href }}" tabindex="-1" aria-hidden="true">{% include components/cover.html entry=card alt="decorative" %}</a> +{%- else -%} +<div class="book-card__cover">{% include components/cover.html entry=card alt="described" %}</div> +{%- endif -%} +{%- endcapture -%} +{%- capture card_title_html -%} +<{{ card_heading }} class="book-card__title">{% if card_href != "" %}<a href="{{ card_href }}">{{ card_title }}</a>{% else %}{{ card_title }}{% endif %}</{{ card_heading }}> +{%- endcapture -%} +{%- if card_variant == "compact" -%} +<article class="book-card book-card--compact"> + {{ card_cover }} + <div class="book-card__body"> + {{ card_title_html }} + {%- if card.book_author %} + <p class="book-card__author">{{ card.book_author }}</p> + {%- endif %} + {%- capture card_line %}{% include components/rating.html value=card.rating %}{% include components/badge.html status=card.status %}{% endcapture %} + {%- if card_line != "" %} + <div class="rating-line">{{ card_line }}</div> + {%- endif %} + {%- if card.status == "reading" and card.pages and card.current_page %} + {%- assign card_percent = card.current_page | times: 100.0 | divided_by: card.pages | round %} + <div class="progress"><progress max="{{ card.pages }}" value="{{ card.current_page }}" aria-label="{% include data/t.html key="progress_through" n=card_title %}">{{ card_percent }}%</progress><p class="progress__label"><span>{% include data/t.html key="page_of" n=card.current_page %} {% include data/t.html key="of" %} {{ card.pages }}</span><span class="od-nowrap">{{ card_percent }}%</span></p></div> + {%- elsif card.status == "dnf" and card.current_page %} + <p class="book-card__meta">{% include data/t.html key="stopped_at" n=card.current_page %}{% if card.pages %} {% include data/t.html key="of" %} {{ card.pages }}{% endif %}</p> + {%- endif %} + </div> +</article> +{%- elsif card_variant == "own" -%} +<article class="book-card book-card--author"> + {{ card_cover }} + <div class="book-card__body"> + {%- capture card_eyebrow %}{{ card.year }}{% if card.year and card.kind %} · {% endif %}{{ card.kind }}{% endcapture %} + {%- if card_eyebrow != "" %} + <span class="eyebrow">{{ card_eyebrow }}</span> + {%- endif %} + {{ card_title_html }} + {%- if card.blurb %} + <p class="book-card__excerpt">{{ card.blurb }}</p> + {%- endif %} + {%- if card.buy_url or card_href != "" %} + <div class="book-card__actions"> + {%- if card.buy_url %} + <a class="button" href="{% include components/url.html url=card.buy_url %}">{% include data/t.html key="buy" %}<span class="visually-hidden"> {{ card_title }}</span></a> + {%- endif %} + {%- if card_href != "" %} + <a class="button button--outline" href="{{ card_href }}">{% include data/t.html key="learn_more" %}<span class="visually-hidden"> {% include data/t.html key="learn_more_about" n=card_title %}</span></a> + {%- endif %} + </div> + {%- endif %} + </div> +</article> +{%- else -%} +<article class="book-card"> + {{ card_cover }} + <div class="book-card__body"> + {%- if card.genre %} + <span class="eyebrow">{{ card.genre }}</span> + {%- endif %} + {{ card_title_html }} + {%- if card.book_author %} + <p class="book-card__author">{% include data/t.html key="by" n=card.book_author %}</p> + {%- endif %} + {%- if card.rating %} + <div class="rating-line">{% include components/rating.html value=card.rating %}</div> + {%- endif %} + {%- if include.excerpt != nil and include.excerpt != "" %} + {%- assign card_excerpt = card.excerpt | strip_html | strip %} + {%- if card_excerpt != "" %} + <p class="book-card__excerpt{% if include.excerpt == "clamp" %} od-clamp-3{% endif %}">{{ card_excerpt }}</p> + {%- endif %} + {%- endif %} + {%- if card.date %} + {%- assign card_date_format = site.readerly.date_format | default: "%-d %B %Y" %} + <p class="book-card__meta"><time datetime="{{ card.date | date: "%Y-%m-%d" }}">{{ card.date | date: card_date_format }}</time></p> + {%- endif %} + </div> +</article> +{%- endif -%} diff --git a/jekyll/theme/_includes/components/cover.html b/jekyll/theme/_includes/components/cover.html new file mode 100644 index 0000000..42d76cd --- /dev/null +++ b/jekyll/theme/_includes/components/cover.html @@ -0,0 +1,11 @@ +{%- comment -%} +A book cover: the entry's cover image, or the typeset placeholder when it has none. +include.alt: "decorative" (the cover sits inside a link that repeats the title) or "described". +{%- endcomment -%} +{%- assign cover_title = include.entry.book_title | default: include.entry.title -%} +{%- capture cover_name -%}{{ cover_title }}{% if include.entry.book_author %} {% include data/t.html key="by" n=include.entry.book_author %}{% endif %}{%- endcapture -%} +{%- if include.entry.cover -%} +<img class="cover" src="{% include components/url.html url=include.entry.cover %}" width="400" height="600" alt="{% if include.alt == "described" %}{% include data/t.html key="cover_of" n=cover_name %}{% endif %}" loading="lazy"> +{%- else -%} +<div class="cover cover--placeholder" role="img" aria-label="{% include data/t.html key="no_cover" n=cover_name %}"><strong>{{ cover_title }}</strong>{% if include.entry.book_author %}<span>{{ include.entry.book_author }}</span>{% endif %}</div> +{%- endif -%} diff --git a/jekyll/theme/_includes/components/genre-link.html b/jekyll/theme/_includes/components/genre-link.html new file mode 100644 index 0000000..97b84ff --- /dev/null +++ b/jekyll/theme/_includes/components/genre-link.html @@ -0,0 +1,12 @@ +{%- comment -%} +include.name as a link to its genre (see data/genre-url.html). When the site has no +archive page it is an <a> without href: plain text that keeps the link's styling. include.class goes on the element; include.content +replaces the visible name. +{%- endcomment -%} +{%- include data/genre-url.html name=include.name -%} +{%- assign genre_label = include.content | default: include.name -%} +{%- if genre_url -%} +<a{% if include.class %} class="{{ include.class }}"{% endif %} href="{{ genre_url }}">{{ genre_label }}</a> +{%- else -%} +<a{% if include.class %} class="{{ include.class }}"{% endif %}>{{ genre_label }}</a> +{%- endif -%} diff --git a/jekyll/theme/_includes/components/intro.html b/jekyll/theme/_includes/components/intro.html new file mode 100644 index 0000000..c220b0b --- /dev/null +++ b/jekyll/theme/_includes/components/intro.html @@ -0,0 +1,19 @@ +{%- comment -%} The intro block (eyebrow, h1, lead, buttons) from page.intro. The heading falls back to the page or site title. {%- endcomment -%} +{%- assign intro = page.intro -%} +{%- assign intro_heading = intro.heading | default: page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" | strip -%} +<div class="intro"> + {%- if intro.eyebrow %} + <span class="eyebrow">{{ intro.eyebrow }}</span> + {%- endif %} + <h1>{{ intro_heading }}</h1> + {%- if intro.lead %} + <p class="lead muted">{{ intro.lead | markdownify | remove: "<p>" | remove: "</p>" | strip }}</p> + {%- endif %} + {%- if intro.buttons %} + <div class="buttons"> + {%- for intro_button in intro.buttons %} + <a class="button{% unless forloop.first %} button--outline{% endunless %}" href="{% include components/url.html url=intro_button.url %}">{{ intro_button.title }}</a> + {%- endfor %} + </div> + {%- endif %} + </div> diff --git a/jekyll/theme/_includes/components/number.html b/jekyll/theme/_includes/components/number.html new file mode 100644 index 0000000..657023c --- /dev/null +++ b/jekyll/theme/_includes/components/number.html @@ -0,0 +1,9 @@ +{%- comment -%} Prints a whole number with a thousands separator (site.readerly.thousands, default ","). {%- endcomment -%} +{%- assign number_digits = include.value | append: "" -%} +{%- assign number_size = number_digits.size -%} +{%- for number_i in (1..number_size) -%} +{%- assign number_at = number_i | minus: 1 -%} +{{- number_digits | slice: number_at -}} +{%- assign number_rest = number_size | minus: number_i | modulo: 3 -%} +{%- if number_rest == 0 and number_i < number_size %}{{ site.readerly.thousands | default: "," }}{% endif -%} +{%- endfor -%} diff --git a/jekyll/theme/_includes/components/pagination.html b/jekyll/theme/_includes/components/pagination.html new file mode 100644 index 0000000..cd910cd --- /dev/null +++ b/jekyll/theme/_includes/components/pagination.html @@ -0,0 +1,22 @@ +{%- if paginator.total_pages > 1 -%} +{%- assign pager_path = site.paginate_path | default: "/page:num/" -%} +{%- assign pager_first = pager_path | split: "/" | pop | join: "/" | append: "/" -%} +<nav class="pagination" aria-label="{% include data/t.html key="pagination" %}"> + <ul> + {%- if paginator.previous_page %} + <li><a class="pagination__dir" href="{{ paginator.previous_page_path | relative_url }}">{% include shell/icon.html name="arrow-left" %} {% include data/t.html key="newer" %}</a></li> + {%- else %} + <li><span class="pagination__dir is-disabled" aria-disabled="true">{% include shell/icon.html name="arrow-left" %} {% include data/t.html key="newer" %}</span></li> + {%- endif %} + {%- for pager_n in (1..paginator.total_pages) %} + {%- if pager_n == 1 %}{% assign pager_url = pager_first %}{% else %}{% assign pager_n_s = pager_n | append: "" %}{% assign pager_url = pager_path | replace: ":num", pager_n_s %}{% endif %} + <li><a href="{{ pager_url | relative_url }}"{% if pager_n == paginator.page %} aria-current="page"{% endif %}><span class="visually-hidden">{% include data/t.html key="page_of" n="" %}</span>{{ pager_n }}</a></li> + {%- endfor %} + {%- if paginator.next_page %} + <li><a class="pagination__dir" href="{{ paginator.next_page_path | relative_url }}">{% include data/t.html key="older" %} {% include shell/icon.html name="arrow-right" %}</a></li> + {%- else %} + <li><span class="pagination__dir is-disabled" aria-disabled="true">{% include data/t.html key="older" %} {% include shell/icon.html name="arrow-right" %}</span></li> + {%- endif %} + </ul> +</nav> +{%- endif -%} diff --git a/jekyll/theme/_includes/components/rating.html b/jekyll/theme/_includes/components/rating.html new file mode 100644 index 0000000..2065709 --- /dev/null +++ b/jekyll/theme/_includes/components/rating.html @@ -0,0 +1,4 @@ +{%- comment -%} Stars for include.value (0 to 5). include.size: "large" adds " / 5". Prints nothing without a value. {%- endcomment -%} +{%- if include.value -%} +<span class="rating{% if include.size == "large" %} rating--large{% endif %}" style="--rating: {{ include.value }}" role="img" aria-label="{% include data/t.html key="rated" n=include.value %}"></span><span aria-hidden="true">{{ include.value }}{% if include.size == "large" %} / 5{% endif %}</span> +{%- endif -%} diff --git a/jekyll/theme/_includes/components/related.html b/jekyll/theme/_includes/components/related.html new file mode 100644 index 0000000..5bfe1d4 --- /dev/null +++ b/jekyll/theme/_includes/components/related.html @@ -0,0 +1,26 @@ +{%- comment -%} "You might also like": the newest other posts in this post's genre, up to readerly.related_posts (default 3, 0 turns it off). {%- endcomment -%} +{%- assign related_limit = site.readerly.related_posts | default: 3 -%} +{%- if page.genre and related_limit > 0 -%} +{%- assign related_posts = "" | split: "" -%} +{%- assign related_candidates = site.posts | where: "genre", page.genre -%} +{%- for related_post in related_candidates -%} +{%- if related_post.url != page.url and related_posts.size < related_limit -%}{%- assign related_posts = related_posts | push: related_post -%}{%- endif -%} +{%- endfor -%} +{%- if related_posts.size > 0 -%} +{%- capture related_heading %}{% include data/t.html key="you_might_also_like" %}{% endcapture -%} +{%- include data/genre-url.html name=page.genre -%} +{%- assign related_genre_lower = page.genre | downcase -%} +{%- capture related_more_label %}{% include data/t.html key="more_in" n=related_genre_lower %}{% endcapture %} + + <section class="section section--tight" aria-labelledby="related-title"> + {% include components/section-head.html id="related-title" heading=related_heading more_url=genre_url more_label=related_more_label %} + <ul class="book-grid book-grid--related"> + {%- for related_post in related_posts %} + <li> + {% include components/book-card.html entry=related_post %} + </li> + {%- endfor %} + </ul> + </section> +{%- endif -%} +{%- endif -%} diff --git a/jekyll/theme/_includes/components/review-jsonld.html b/jekyll/theme/_includes/components/review-jsonld.html new file mode 100644 index 0000000..45407ae --- /dev/null +++ b/jekyll/theme/_includes/components/review-jsonld.html @@ -0,0 +1,5 @@ +{%- if page.rating and page.book_author -%} +{%- assign jsonld_author = page.author.name | default: page.author | default: site.author.name -%} +{%- capture jsonld -%}{"@context":"https://schema.org","@type":"Review","url":{{ page.url | absolute_url | jsonify }},"datePublished":{{ page.date | date: "%Y-%m-%d" | jsonify }},"name":{{ page.title | jsonify }}{% if jsonld_author %},"author":{"@type":"Person","name":{{ jsonld_author | jsonify }}}{% endif %},"reviewRating":{"@type":"Rating","ratingValue":{{ page.rating | jsonify }},"bestRating":5,"worstRating":0},"itemReviewed":{"@type":"Book","name":{{ page.book_title | default: page.title | jsonify }},"author":{"@type":"Person","name":{{ page.book_author | jsonify }}}{% if page.pages %},"numberOfPages":{{ page.pages | jsonify }}{% endif %}{% if page.cover %},"image":{% if page.cover contains "://" %}{{ page.cover | jsonify }}{% else %}{{ page.cover | absolute_url | jsonify }}{% endif %}{% endif %}}}{%- endcapture -%} +<script type="application/ld+json">{{ jsonld | replace: "</", "<\/" }}</script> +{%- endif -%} diff --git a/jekyll/theme/_includes/components/section-head.html b/jekyll/theme/_includes/components/section-head.html new file mode 100644 index 0000000..084b830 --- /dev/null +++ b/jekyll/theme/_includes/components/section-head.html @@ -0,0 +1,12 @@ +{%- comment -%} +The heading row of a section. include.id, include.heading (text), include.count (HTML), +include.note (text under or beside the heading), include.more_url and include.more_label. +{%- endcomment -%} +<div class="section-head"> + <h2 id="{{ include.id }}">{{ include.heading }}{% if include.count %} <span class="count">{{ include.count }}</span>{% endif %}</h2> + {%- if include.more_url %} + <a class="more-link" href="{{ include.more_url }}">{{ include.more_label }} {% include shell/icon.html name="arrow-right" %}</a> + {%- elsif include.note %} + <p>{{ include.note }}</p> + {%- endif %} +</div> diff --git a/jekyll/theme/_includes/components/shelf.html b/jekyll/theme/_includes/components/shelf.html new file mode 100644 index 0000000..687734c --- /dev/null +++ b/jekyll/theme/_includes/components/shelf.html @@ -0,0 +1,7 @@ +<ul class="shelf" tabindex="0" aria-label="{% include data/t.html key="scrollable_shelf" n=include.label %}"> + {%- for shelf_entry in include.entries %} + <li> + {% include components/book-card.html entry=shelf_entry variant="compact" %} + </li> + {%- endfor %} + </ul> diff --git a/jekyll/theme/_includes/components/url.html b/jekyll/theme/_includes/components/url.html new file mode 100644 index 0000000..0b3ac5c --- /dev/null +++ b/jekyll/theme/_includes/components/url.html @@ -0,0 +1,8 @@ +{%- comment -%} Prints include.url, prefixed with the site's baseurl when it is a path on this site. {%- endcomment -%} +{%- assign url_first = include.url | slice: 0 -%} +{%- assign url_first_two = include.url | slice: 0, 2 -%} +{%- if include.url contains "://" or include.url contains "mailto:" or url_first == "#" or url_first == "?" or url_first_two == "//" -%} +{{- include.url | escape_once -}} +{%- else -%} +{{- include.url | relative_url | escape_once -}} +{%- endif -%} diff --git a/jekyll/theme/_includes/data/entries.html b/jekyll/theme/_includes/data/entries.html new file mode 100644 index 0000000..ecad15e --- /dev/null +++ b/jekyll/theme/_includes/data/entries.html @@ -0,0 +1,24 @@ +{%- comment -%} +Assigns entries: every book entry with include.status, newest first. Entries are +review posts plus _data/reading_log.yml, the only two sources of book entries. +With include.year, only entries finished in that year are kept. +{%- endcomment -%} +{%- assign entries = site.posts | where: "status", include.status -%} +{%- if site.data.reading_log -%} +{%- assign entries_data = site.data.reading_log | where: "status", include.status -%} +{%- assign entries = entries | concat: entries_data -%} +{%- endif -%} +{%- if include.status == "read" -%} +{%- assign entries = entries | sort: "finished" | reverse -%} +{%- endif -%} +{%- if include.year -%} +{%- assign entries_year = include.year | append: "" -%} +{%- assign entries_all = entries -%} +{%- assign entries = "" | split: "" -%} +{%- for entry in entries_all -%} +{%- if entry.finished -%} +{%- assign entry_year = entry.finished | date: "%Y" -%} +{%- if entry_year == entries_year -%}{%- assign entries = entries | push: entry -%}{%- endif -%} +{%- endif -%} +{%- endfor -%} +{%- endif -%} diff --git a/jekyll/theme/_includes/data/featured.html b/jekyll/theme/_includes/data/featured.html new file mode 100644 index 0000000..3b4a89e --- /dev/null +++ b/jekyll/theme/_includes/data/featured.html @@ -0,0 +1,14 @@ +{%- comment -%} +Assigns featured_post: the newest review with featured: true, else the newest review. +A review is a post with a cover, a book author or a rating; a plain post never fills +the feature card, which presents a book. +{%- endcomment -%} +{%- assign featured_post = nil -%} +{%- assign featured_fallback = nil -%} +{%- for featured_candidate in site.posts -%} +{%- if featured_candidate.cover or featured_candidate.book_author or featured_candidate.rating -%} +{%- unless featured_fallback %}{% assign featured_fallback = featured_candidate %}{% endunless -%} +{%- if featured_candidate.featured -%}{%- assign featured_post = featured_candidate -%}{%- break -%}{%- endif -%} +{%- endif -%} +{%- endfor -%} +{%- unless featured_post %}{% assign featured_post = featured_fallback %}{% endunless -%} diff --git a/jekyll/theme/_includes/data/find-page.html b/jekyll/theme/_includes/data/find-page.html new file mode 100644 index 0000000..740b2f1 --- /dev/null +++ b/jekyll/theme/_includes/data/find-page.html @@ -0,0 +1,12 @@ +{%- comment -%} +Assigns found_page: the first page whose layout is include.layout. For the +archive layout it skips genre pages, so it finds the page that lists every review. +{%- endcomment -%} +{%- assign found_page = nil -%} +{%- assign find_candidates = site.pages | where: "layout", include.layout -%} +{%- for find_candidate in find_candidates -%} +{%- if include.layout != "archive" or find_candidate.genre == nil -%} +{%- assign found_page = find_candidate -%} +{%- break -%} +{%- endif -%} +{%- endfor -%} diff --git a/jekyll/theme/_includes/data/genre-url.html b/jekyll/theme/_includes/data/genre-url.html new file mode 100644 index 0000000..6e52593 --- /dev/null +++ b/jekyll/theme/_includes/data/genre-url.html @@ -0,0 +1,15 @@ +{%- comment -%} +Assigns genre_url for include.name: its genre page (layout: archive, genre: <name>), +else the archive page filtered with ?genre=, else nil. +{%- endcomment -%} +{%- assign genre_page = site.pages | where: "layout", "archive" | where: "genre", include.name | first -%} +{%- if genre_page -%} +{%- assign genre_url = genre_page.url | relative_url -%} +{%- else -%} +{%- include data/find-page.html layout="archive" -%} +{%- if found_page -%} +{%- capture genre_url %}{{ found_page.url | relative_url }}?genre={{ include.name | url_encode }}{% endcapture -%} +{%- else -%} +{%- assign genre_url = nil -%} +{%- endif -%} +{%- endif -%} diff --git a/jekyll/theme/_includes/data/t.html b/jekyll/theme/_includes/data/t.html new file mode 100644 index 0000000..31cfaa0 --- /dev/null +++ b/jekyll/theme/_includes/data/t.html @@ -0,0 +1,106 @@ +{%- comment -%} +Prints one interface string: site.data.readerly_strings[include.key] when the +site defines it, else the English default below. %n is replaced by include.n, HTML-escaped once, so it is safe inside an attribute. +{%- endcomment -%} +{%- assign t_text = site.data.readerly_strings[include.key] -%} +{%- unless t_text -%} +{%- case include.key -%} +{%- when "skip" -%}{%- assign t_text = "Skip to content" -%} +{%- when "search_reviews" -%}{%- assign t_text = "Search reviews" -%} +{%- when "search_placeholder" -%}{%- assign t_text = "Search by title, author or genre" -%} +{%- when "search" -%}{%- assign t_text = "Search" -%} +{%- when "dark_theme" -%}{%- assign t_text = "Dark theme" -%} +{%- when "primary_nav" -%}{%- assign t_text = "Primary" -%} +{%- when "by" -%}{%- assign t_text = "by %n" -%} +{%- when "byline" -%}{%- assign t_text = "By" -%} +{%- when "min_read" -%}{%- assign t_text = "%n min read" -%} +{%- when "latest_review" -%}{%- assign t_text = "Latest review" -%} +{%- when "featured_review" -%}{%- assign t_text = "Featured review" -%} +{%- when "read_the_review" -%}{%- assign t_text = "Read the review" -%} +{%- when "recent_reviews" -%}{%- assign t_text = "Recent reviews" -%} +{%- when "all_reviews" -%}{%- assign t_text = "All reviews" -%} +{%- when "browse_all_reviews" -%}{%- assign t_text = "Browse all reviews" -%} +{%- when "page_n" -%}{%- assign t_text = "Page %n" -%} +{%- when "pagination" -%}{%- assign t_text = "Pagination" -%} +{%- when "newer" -%}{%- assign t_text = "Newer" -%} +{%- when "older" -%}{%- assign t_text = "Older" -%} +{%- when "currently_reading" -%}{%- assign t_text = "Currently reading" -%} +{%- when "my_reading_log" -%}{%- assign t_text = "My reading log" -%} +{%- when "browse_by_genre" -%}{%- assign t_text = "Browse by genre" -%} +{%- when "reviews_and_counting" -%}{%- assign t_text = "%n reviews and counting" -%} +{%- when "reviews_one" -%}{%- assign t_text = "1 review" -%} +{%- when "reviews_many" -%}{%- assign t_text = "%n reviews" -%} +{%- when "books_one" -%}{%- assign t_text = "1 book" -%} +{%- when "books_many" -%}{%- assign t_text = "%n books" -%} +{%- when "rated" -%}{%- assign t_text = "Rated %n out of 5" -%} +{%- when "status_reading" -%}{%- assign t_text = "Reading" -%} +{%- when "status_read" -%}{%- assign t_text = "Read" -%} +{%- when "status_want" -%}{%- assign t_text = "Want to read" -%} +{%- when "status_dnf" -%}{%- assign t_text = "Did not finish" -%} +{%- when "status_dnf_short" -%}{%- assign t_text = "DNF" -%} +{%- when "progress_through" -%}{%- assign t_text = "Progress through %n" -%} +{%- when "page_of" -%}{%- assign t_text = "Page %n" -%} +{%- when "of" -%}{%- assign t_text = "of" -%} +{%- when "stopped_at" -%}{%- assign t_text = "Stopped at page %n" -%} +{%- when "cover_of" -%}{%- assign t_text = "Cover of %n" -%} +{%- when "no_cover" -%}{%- assign t_text = "No cover image yet: %n" -%} +{%- when "shelf_read" -%}{%- assign t_text = "Read" -%} +{%- when "shelf_read_year" -%}{%- assign t_text = "Read in %n" -%} +{%- when "shelf_read_note" -%}{%- assign t_text = "Most recently finished first" -%} +{%- when "shelf_want" -%}{%- assign t_text = "Want to read" -%} +{%- when "shelf_dnf" -%}{%- assign t_text = "Did not finish" -%} +{%- when "scrollable_shelf" -%}{%- assign t_text = "%n, scrollable shelf" -%} +{%- when "stats_label" -%}{%- assign t_text = "%n reading statistics" -%} +{%- when "stats_label_all" -%}{%- assign t_text = "Reading statistics" -%} +{%- when "stat_books" -%}{%- assign t_text = "Books read" -%} +{%- when "stat_pages" -%}{%- assign t_text = "Pages read" -%} +{%- when "stat_rating" -%}{%- assign t_text = "Average rating" -%} +{%- when "stat_dnf" -%}{%- assign t_text = "Did not finish" -%} +{%- when "genres_and_tags" -%}{%- assign t_text = "Genres and tags" -%} +{%- when "related_genres" -%}{%- assign t_text = "Related genres" -%} +{%- when "series" -%}{%- assign t_text = "Series" -%} +{%- when "pages" -%}{%- assign t_text = "Pages" -%} +{%- when "published" -%}{%- assign t_text = "Published" -%} +{%- when "my_rating" -%}{%- assign t_text = "My rating" -%} +{%- when "status" -%}{%- assign t_text = "Status" -%} +{%- when "finished_on" -%}{%- assign t_text = "finished %n" -%} +{%- when "my_verdict" -%}{%- assign t_text = "My verdict" -%} +{%- when "what_worked" -%}{%- assign t_text = "What worked" -%} +{%- when "less_so" -%}{%- assign t_text = "Less so" -%} +{%- when "reviewed_by" -%}{%- assign t_text = "Reviewed by" -%} +{%- when "more_about" -%}{%- assign t_text = "More about %n" -%} +{%- when "portrait_of" -%}{%- assign t_text = "Portrait of %n" -%} +{%- when "you_might_also_like" -%}{%- assign t_text = "You might also like" -%} +{%- when "more_in" -%}{%- assign t_text = "More %n" -%} +{%- when "review" -%}{%- assign t_text = "review" -%} +{%- when "email_address" -%}{%- assign t_text = "Email address" -%} +{%- when "subscribe" -%}{%- assign t_text = "Subscribe" -%} +{%- when "new_release" -%}{%- assign t_text = "New release" -%} +{%- when "buy_the_book" -%}{%- assign t_text = "Buy the book" -%} +{%- when "learn_more" -%}{%- assign t_text = "Learn more" -%} +{%- when "learn_more_about" -%}{%- assign t_text = "about %n" -%} +{%- when "buy" -%}{%- assign t_text = "Buy" -%} +{%- when "where_to_buy" -%}{%- assign t_text = "Where to buy" -%} +{%- when "my_books" -%}{%- assign t_text = "My books" -%} +{%- when "kind_words" -%}{%- assign t_text = "Kind words" -%} +{%- when "events" -%}{%- assign t_text = "Events" -%} +{%- when "event_details" -%}{%- assign t_text = "Details" -%} +{%- when "about_author" -%}{%- assign t_text = "About %n" -%} +{%- when "genre" -%}{%- assign t_text = "Genre" -%} +{%- when "archive" -%}{%- assign t_text = "Archive" -%} +{%- when "you_searched_for" -%}{%- assign t_text = "You searched for" -%} +{%- when "showing" -%}{%- assign t_text = "Showing" -%} +{%- when "match_none" -%}{%- assign t_text = "No reviews match." -%} +{%- when "match_one" -%}{%- assign t_text = "1 review matches." -%} +{%- when "match_many" -%}{%- assign t_text = "%n reviews match." -%} +{%- when "not_found_title" -%}{%- assign t_text = "This page has wandered off the shelf" -%} +{%- when "not_found_lead" -%}{%- assign t_text = "The link may be old, or the page may have been moved or renamed. Try a search, or start again from the front page." -%} +{%- when "not_found_lead_no_search" -%}{%- assign t_text = "The link may be old, or the page may have been moved or renamed. Start again from the front page." -%} +{%- when "back_to_front" -%}{%- assign t_text = "Back to the front page" -%} +{%- when "pick_something" -%}{%- assign t_text = "Or pick something to read" -%} +{%- when "recent_favourites" -%}{%- assign t_text = "Recent favourites" -%} +{%- else -%}{%- assign t_text = include.key -%} +{%- endcase -%} +{%- endunless -%} +{%- assign t_n = include.n | escape_once -%} +{{- t_text | replace: "%n", t_n -}} diff --git a/jekyll/theme/_includes/head-custom.html b/jekyll/theme/_includes/head-custom.html new file mode 100644 index 0000000..e69de29 diff --git a/jekyll/theme/_includes/sections/author-hero.html b/jekyll/theme/_includes/sections/author-hero.html new file mode 100644 index 0000000..b8e25bb --- /dev/null +++ b/jekyll/theme/_includes/sections/author-hero.html @@ -0,0 +1,32 @@ +{%- assign hero = page.hero -%} +{%- assign hero_name = page.title | default: site.title -%} +<section class="section" id="about" aria-label="{% include data/t.html key="about_author" n=hero_name %}"> + <div class="wrap"> + <div class="author-hero"> + {%- if hero.portrait %} + <div class="author-hero__portrait"> + <img src="{% include components/url.html url=hero.portrait %}" width="800" height="1000" alt="{% include data/t.html key="portrait_of" n=hero_name %}"> + </div> + {%- endif %} + <div class="author-hero__body"> + {%- if hero.eyebrow %} + <span class="eyebrow">{{ hero.eyebrow }}</span> + {%- endif %} + <h1>{{ hero_name }}</h1> + {%- if hero.lead %} + <p class="lead">{{ hero.lead | markdownify | remove: "<p>" | remove: "</p>" | strip }}</p> + {%- endif %} + {%- if hero.text %} + <p class="muted">{{ hero.text | markdownify | remove: "<p>" | remove: "</p>" | strip }}</p> + {%- endif %} + {%- if hero.buttons %} + <div class="buttons"> + {%- for hero_button in hero.buttons %} + <a class="button{% unless forloop.first %} button--outline{% endunless %}" href="{% include components/url.html url=hero_button.url %}">{{ hero_button.title }}</a> + {%- endfor %} + </div> + {%- endif %} + </div> + </div> + </div> + </section> diff --git a/jekyll/theme/_includes/sections/books.html b/jekyll/theme/_includes/sections/books.html new file mode 100644 index 0000000..0cbccf0 --- /dev/null +++ b/jekyll/theme/_includes/sections/books.html @@ -0,0 +1,18 @@ +{%- assign books_titled = site.data.books | where_exp: "own_book", "own_book.title" -%} +{%- if books_titled.size > 0 -%} +{%- assign books_section = page.books -%} +{%- capture books_heading %}{{ books_section.heading | default: "" }}{% endcapture -%} +{%- if books_heading == "" %}{% capture books_heading %}{% include data/t.html key="my_books" %}{% endcapture %}{% endif -%} +<section class="section" id="books" aria-labelledby="books-title"> + <div class="wrap"> + {% include components/section-head.html id="books-title" heading=books_heading note=books_section.note %} + <ul class="book-grid book-grid--four"> + {%- for own_book in books_titled %} + <li> + {% include components/book-card.html entry=own_book variant="own" %} + </li> + {%- endfor %} + </ul> + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/content.html b/jekyll/theme/_includes/sections/content.html new file mode 100644 index 0000000..c1a8a4a --- /dev/null +++ b/jekyll/theme/_includes/sections/content.html @@ -0,0 +1,8 @@ +{%- assign section_content = content | strip -%} +{%- if section_content != "" -%} +<section class="section"> + <div class="wrap wrap--content entry-content"> +{{ content }} + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/currently-reading.html b/jekyll/theme/_includes/sections/currently-reading.html new file mode 100644 index 0000000..fca0efb --- /dev/null +++ b/jekyll/theme/_includes/sections/currently-reading.html @@ -0,0 +1,28 @@ +{%- include data/entries.html status="reading" -%} +{%- if entries.size > 0 -%} +{%- assign reading_entries = entries -%} +{%- include data/find-page.html layout="reading-log" -%} +{%- assign reading_section = page["currently-reading"] -%} +{%- capture reading_heading %}{{ reading_section.heading | default: "" }}{% endcapture -%} +{%- if reading_heading == "" %}{% capture reading_heading %}{% include data/t.html key="currently_reading" %}{% endcapture %}{% endif -%} +{%- assign reading_count = nil -%} +{%- assign reading_more = nil -%} +{%- if found_page and found_page.url != page.url -%} +{%- capture reading_more %}{{ found_page.url | relative_url }}{% endcapture -%} +{%- capture reading_more_label %}{% include data/t.html key="my_reading_log" %}{% endcapture -%} +{%- else -%} +{%- capture reading_count %}{% if reading_entries.size == 1 %}{% include data/t.html key="books_one" %}{% else %}{% include data/t.html key="books_many" n=reading_entries.size %}{% endif %}{% endcapture -%} +{%- endif -%} +<section class="section section--band" aria-labelledby="reading-title"> + <div class="wrap"> + {% include components/section-head.html id="reading-title" heading=reading_heading count=reading_count note=reading_section.note more_url=reading_more more_label=reading_more_label %} + <ul class="book-grid book-grid--compact"> + {%- for reading_entry in reading_entries %} + <li> + {% include components/book-card.html entry=reading_entry variant="compact" %} + </li> + {%- endfor %} + </ul> + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/events.html b/jekyll/theme/_includes/sections/events.html new file mode 100644 index 0000000..bf64677 --- /dev/null +++ b/jekyll/theme/_includes/sections/events.html @@ -0,0 +1,35 @@ +{%- assign events_today = site.time | date: "%Y%m%d" | plus: 0 -%} +{%- assign events_upcoming = "" | split: "" -%} +{%- assign events_sorted = site.data.events | sort: "date" -%} +{%- for event_item in events_sorted -%} +{%- assign event_day = event_item.date | date: "%Y%m%d" | plus: 0 -%} +{%- if event_item.title and event_day >= events_today -%}{%- assign events_upcoming = events_upcoming | push: event_item -%}{%- endif -%} +{%- endfor -%} +{%- if events_upcoming.size > 0 -%} +{%- assign events_section = page.events -%} +{%- capture events_heading %}{{ events_section.heading | default: "" }}{% endcapture -%} +{%- if events_heading == "" %}{% capture events_heading %}{% include data/t.html key="events" %}{% endcapture %}{% endif -%} +<section class="section" id="events" aria-labelledby="events-title"> + <div class="wrap"> + {% include components/section-head.html id="events-title" heading=events_heading note=events_section.note %} + <ul class="events"> + {%- for event_item in events_upcoming %} + <li> + <article class="event"> + <time class="event__date" datetime="{{ event_item.date | date: "%Y-%m-%d" }}"><span class="event__day">{{ event_item.date | date: "%-d" }}</span> <span class="event__month">{{ event_item.date | date: "%b" }}</span></time> + <div> + <h3 class="event__title">{{ event_item.title }}</h3> + {%- if event_item.where %} + <p class="event__where">{{ event_item.where }}</p> + {%- endif %} + </div> + {%- if event_item.url %} + <a class="button button--outline" href="{% include components/url.html url=event_item.url %}">{% if event_item.label %}{{ event_item.label }}{% else %}{% include data/t.html key="event_details" %}{% endif %}<span class="visually-hidden">: {{ event_item.title }}</span></a> + {%- endif %} + </article> + </li> + {%- endfor %} + </ul> + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/featured-review.html b/jekyll/theme/_includes/sections/featured-review.html new file mode 100644 index 0000000..5d02a48 --- /dev/null +++ b/jekyll/theme/_includes/sections/featured-review.html @@ -0,0 +1,32 @@ +{%- include data/featured.html -%} +{%- if featured_post -%} +{%- assign feature = featured_post -%} +{%- capture feature_href %}{{ feature.url | relative_url }}{% endcapture -%} +{%- assign feature_words = feature.content | strip_html | number_of_words -%} +{%- assign feature_minutes = feature_words | divided_by: 200 | at_least: 1 -%} +{%- assign feature_date_format = site.readerly.date_format | default: "%-d %B %Y" -%} +<section class="section section--tight" aria-labelledby="latest-title"> + <div class="wrap"> + <article class="feature"> + <a class="cover-link" href="{{ feature_href }}" tabindex="-1" aria-hidden="true">{% include components/cover.html entry=feature alt="decorative" %}</a> + <div class="feature__body"> + <span class="eyebrow">{% if feature.featured %}{% include data/t.html key="featured_review" %}{% else %}{% include data/t.html key="latest_review" %}{% endif %}{% if feature.genre %} · {{ feature.genre }}{% endif %}</span> + <h2 class="feature__title" id="latest-title"><a href="{{ feature_href }}">{{ feature.book_title | default: feature.title }}</a></h2> + {%- capture feature_byline %}{% if feature.book_author %}{% include data/t.html key="by" n=feature.book_author %}{% endif %}{% if feature.book_author and feature.series %} · {% endif %}{{ feature.series }}{% endcapture %} + {%- if feature_byline != "" %} + <p class="muted">{{ feature_byline }}</p> + {%- endif %} + {%- if feature.rating %} + <div class="rating-line">{% include components/rating.html value=feature.rating size="large" %}</div> + {%- endif %} + {%- assign feature_excerpt = feature.excerpt | strip_html | strip %} + {%- if feature_excerpt != "" %} + <p class="lead">{{ feature_excerpt }}</p> + {%- endif %} + <p class="book-card__meta"><time datetime="{{ feature.date | date: "%Y-%m-%d" }}">{{ feature.date | date: feature_date_format }}</time> · {% include data/t.html key="min_read" n=feature_minutes %}</p> + <a class="button" href="{{ feature_href }}">{% include data/t.html key="read_the_review" %} {% include shell/icon.html name="arrow-right" %}</a> + </div> + </article> + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/genres.html b/jekyll/theme/_includes/sections/genres.html new file mode 100644 index 0000000..69383d6 --- /dev/null +++ b/jekyll/theme/_includes/sections/genres.html @@ -0,0 +1,23 @@ +{%- assign genre_groups = site.posts | group_by: "genre" | sort: "size" | reverse -%} +{%- assign genre_list = "" | split: "" -%} +{%- for genre_group in genre_groups -%} +{%- if genre_group.name != "" -%}{%- assign genre_list = genre_list | push: genre_group -%}{%- endif -%} +{%- endfor -%} +{%- if genre_list.size > 0 -%} +{%- assign genres_section = page.genres -%} +{%- capture genres_heading %}{{ genres_section.heading | default: "" }}{% endcapture -%} +{%- if genres_heading == "" %}{% capture genres_heading %}{% include data/t.html key="browse_by_genre" %}{% endcapture %}{% endif -%} +{%- capture genres_note %}{{ genres_section.note | default: "" }}{% endcapture -%} +{%- if genres_note == "" %}{% capture genres_note %}{% include data/t.html key="reviews_and_counting" n=site.posts.size %}{% endcapture %}{% endif -%} +<section class="section" aria-labelledby="genres-title"> + <div class="wrap"> + {% include components/section-head.html id="genres-title" heading=genres_heading note=genres_note %} + <ul class="toc"> + {%- for genre_group in genre_list %} + {%- capture genre_label %}<span class="toc__name">{{ genre_group.name }}</span><span class="toc__count">{{ genre_group.size }}<span class="visually-hidden"> {% include data/t.html key="reviews_many" n="" %}</span></span>{% endcapture %} + <li>{% include components/genre-link.html name=genre_group.name content=genre_label %}</li> + {%- endfor %} + </ul> + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/intro-stats.html b/jekyll/theme/_includes/sections/intro-stats.html new file mode 100644 index 0000000..4b568d4 --- /dev/null +++ b/jekyll/theme/_includes/sections/intro-stats.html @@ -0,0 +1,36 @@ +{%- comment -%} +The intro with the year's reading statistics under it, in one block. page.year scopes +"Books read", "Pages read" and "Average rating" to the books finished that year. +{%- endcomment -%} +{%- include data/entries.html status="read" year=page.year -%} +{%- assign stats_read = entries -%} +{%- include data/entries.html status="dnf" -%} +{%- assign stats_dnf = entries.size -%} +{%- assign stats_pages = 0 -%} +{%- assign stats_rating_sum = 0 -%} +{%- assign stats_rated = 0 -%} +{%- for stats_entry in stats_read -%} +{%- if stats_entry.pages %}{% assign stats_pages = stats_pages | plus: stats_entry.pages %}{% endif -%} +{%- if stats_entry.rating %}{% assign stats_rating_sum = stats_rating_sum | plus: stats_entry.rating %}{% assign stats_rated = stats_rated | plus: 1 %}{% endif -%} +{%- endfor -%} +<section class="section section--tight"> + <div class="wrap"> + {% include components/intro.html %} + {%- if stats_read.size > 0 or stats_dnf > 0 %} + <ul class="stats" aria-label="{% if page.year %}{% include data/t.html key="stats_label" n=page.year %}{% else %}{% include data/t.html key="stats_label_all" %}{% endif %}"> + {%- if stats_read.size > 0 %} + <li><p class="od-stat"><span class="stats__number">{% include components/number.html value=stats_read.size %}</span><span class="stats__label">{% include data/t.html key="stat_books" %}</span></p></li> + {%- endif %} + {%- if stats_pages > 0 %} + <li><p class="od-stat"><span class="stats__number">{% include components/number.html value=stats_pages %}</span><span class="stats__label">{% include data/t.html key="stat_pages" %}</span></p></li> + {%- endif %} + {%- if stats_rated > 0 %} + <li><p class="od-stat"><span class="stats__number">{{ stats_rating_sum | times: 1.0 | divided_by: stats_rated | round: 1 }}</span><span class="stats__label">{% include data/t.html key="stat_rating" %}</span></p></li> + {%- endif %} + {%- if stats_dnf > 0 %} + <li><p class="od-stat"><span class="stats__number">{% include components/number.html value=stats_dnf %}</span><span class="stats__label">{% include data/t.html key="stat_dnf" %}</span></p></li> + {%- endif %} + </ul> + {%- endif %} + </div> + </section> diff --git a/jekyll/theme/_includes/sections/intro.html b/jekyll/theme/_includes/sections/intro.html new file mode 100644 index 0000000..8333736 --- /dev/null +++ b/jekyll/theme/_includes/sections/intro.html @@ -0,0 +1,5 @@ +<section class="section section--tight"> + <div class="wrap"> + {% include components/intro.html %} + </div> + </section> diff --git a/jekyll/theme/_includes/sections/new-release.html b/jekyll/theme/_includes/sections/new-release.html new file mode 100644 index 0000000..f5c29bf --- /dev/null +++ b/jekyll/theme/_includes/sections/new-release.html @@ -0,0 +1,43 @@ +{%- assign release = site.data.books | where: "featured", true | first -%} +{%- if release and release.title -%} +<section class="section section--band" id="new-release" aria-labelledby="release-title"> + <div class="wrap"> + <div class="release"> + <div class="release__cover">{% include components/cover.html entry=release alt="described" %}</div> + <div class="release__body"> + <span class="eyebrow">{% if release.label %}{{ release.label }}{% else %}{% include data/t.html key="new_release" %}{% endif %}</span> + <h2 id="release-title">{{ release.title }}</h2> + {%- assign release_lead = release.lead | default: release.blurb %} + {%- if release_lead %} + <p class="lead">{{ release_lead | markdownify | remove: "<p>" | remove: "</p>" | strip }}</p> + {%- endif %} + {%- if release.facts %} + <p class="release__facts">{{ release.facts }}</p> + {%- endif %} + {%- assign release_buy = release.buy_url %} + {%- if release_buy == nil and release.where_to_buy %}{% assign release_buy = "#where-to-buy" %}{% endif %} + {%- if release_buy or release.url %} + <div class="buttons"> + {%- if release_buy %} + <a class="button" href="{% include components/url.html url=release_buy %}">{% include data/t.html key="buy_the_book" %}</a> + {%- endif %} + {%- if release.url %} + <a class="button{% if release_buy %} button--outline{% endif %}" href="{% include components/url.html url=release.url %}">{% if release.url_label %}{{ release.url_label }}{% else %}{% include data/t.html key="learn_more" %}{% endif %}</a> + {%- endif %} + </div> + {%- endif %} + </div> + </div> + {%- if release.where_to_buy %} + <div class="where-to-buy" id="where-to-buy"> + <h3>{% include data/t.html key="where_to_buy" %}</h3> + <ul> + {%- for release_shop in release.where_to_buy %} + <li>{{ release_shop | markdownify | remove: "<p>" | remove: "</p>" | strip }}</li> + {%- endfor %} + </ul> + </div> + {%- endif %} + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/newsletter.html b/jekyll/theme/_includes/sections/newsletter.html new file mode 100644 index 0000000..f5ec9d1 --- /dev/null +++ b/jekyll/theme/_includes/sections/newsletter.html @@ -0,0 +1,38 @@ +{%- comment -%} A sign-up form that posts to readerly.newsletter.action. page.newsletter overrides any of its keys. {%- endcomment -%} +{%- assign newsletter_site = site.readerly.newsletter -%} +{%- assign newsletter_page = page.newsletter -%} +{%- assign newsletter_action = newsletter_page.action | default: newsletter_site.action -%} +{%- if newsletter_action -%} +{%- assign newsletter_eyebrow = newsletter_page.eyebrow | default: newsletter_site.eyebrow -%} +{%- assign newsletter_heading = newsletter_page.heading | default: newsletter_site.heading -%} +{%- assign newsletter_note = newsletter_page.note | default: newsletter_site.note -%} +{%- assign newsletter_field = newsletter_page.field | default: newsletter_site.field | default: "email" -%} +{%- capture newsletter_button %}{{ newsletter_page.button | default: newsletter_site.button }}{% endcapture -%} +{%- if newsletter_button == "" %}{% capture newsletter_button %}{% include data/t.html key="subscribe" %}{% endcapture %}{% endif -%} +<section class="section section--band" id="newsletter"{% if newsletter_heading %} aria-labelledby="newsletter-title"{% endif %}> + <div class="wrap"> + <div class="newsletter"> + {%- if newsletter_eyebrow or newsletter_heading %} + <div class="newsletter__intro"> + {%- if newsletter_eyebrow %} + <span class="eyebrow">{{ newsletter_eyebrow }}</span> + {%- endif %} + {%- if newsletter_heading %} + <h2 id="newsletter-title">{{ newsletter_heading }}</h2> + {%- endif %} + </div> + {%- endif %} + <form class="newsletter__form" action="{{ newsletter_action | escape_once }}" method="post"> + <label for="newsletter-email">{% include data/t.html key="email_address" %}</label> + <div class="newsletter__row"> + <input class="input" id="newsletter-email" type="email" name="{{ newsletter_field | escape_once }}" autocomplete="email" required placeholder="you@example.com"> + <button class="button" type="submit">{{ newsletter_button }}</button> + </div> + {%- if newsletter_note %} + <p class="newsletter__note">{{ newsletter_note }}</p> + {%- endif %} + </form> + </div> + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/praise.html b/jekyll/theme/_includes/sections/praise.html new file mode 100644 index 0000000..7dcfe2c --- /dev/null +++ b/jekyll/theme/_includes/sections/praise.html @@ -0,0 +1,22 @@ +{%- if site.data.praise.size > 0 -%} +{%- assign praise_section = page.praise -%} +{%- capture praise_heading %}{{ praise_section.heading | default: "" }}{% endcapture -%} +{%- if praise_heading == "" %}{% capture praise_heading %}{% include data/t.html key="kind_words" %}{% endcapture %}{% endif -%} +<section class="section" aria-labelledby="praise-title"> + <div class="wrap"> + {% include components/section-head.html id="praise-title" heading=praise_heading note=praise_section.note %} + <ul class="praise"> + {%- for praise_item in site.data.praise %} + <li> + <figure> + <blockquote><p>“{{ praise_item.quote }}”</p></blockquote> + {%- if praise_item.source or praise_item.context %} + <figcaption>{% if praise_item.source %}<strong>{{ praise_item.source }}</strong>{% endif %}{% if praise_item.source and praise_item.context %} {% endif %}{{ praise_item.context }}</figcaption> + {%- endif %} + </figure> + </li> + {%- endfor %} + </ul> + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/recent-reviews.html b/jekyll/theme/_includes/sections/recent-reviews.html new file mode 100644 index 0000000..ca520ab --- /dev/null +++ b/jekyll/theme/_includes/sections/recent-reviews.html @@ -0,0 +1,39 @@ +{%- comment -%} +The review grid: paginator.posts when jekyll-paginate runs on this page, else the +newest posts. Page 1 leaves out the post the featured-review section shows. +{%- endcomment -%} +{%- assign recent_skip = nil -%} +{%- if paginator.page == nil or paginator.page == 1 -%} +{%- if section_names contains "featured-review" -%}{%- include data/featured.html -%}{%- assign recent_skip = featured_post.url -%}{%- endif -%} +{%- endif -%} +{%- if paginator.posts -%} +{%- assign recent_source = paginator.posts -%} +{%- else -%} +{%- assign recent_source = site.posts | slice: 0, 9 -%} +{%- endif -%} +{%- assign recent_posts = "" | split: "" -%} +{%- for recent_post in recent_source -%} +{%- if recent_post.url != recent_skip -%}{%- assign recent_posts = recent_posts | push: recent_post -%}{%- endif -%} +{%- endfor -%} +{%- if recent_posts.size > 0 -%} +{%- include data/find-page.html layout="archive" -%} +<section class="section" aria-labelledby="recent-title"> + <div class="wrap"> + {%- if paginator.page > 1 %} + <h1 class="visually-hidden">{{ site.title }}: {% include data/t.html key="page_n" n=paginator.page %}</h1> + {%- endif %} + {%- capture recent_heading %}{% include data/t.html key="recent_reviews" %}{% endcapture %} + {%- capture recent_more_label %}{% include data/t.html key="all_reviews" %}{% endcapture %} + {%- if found_page %}{% capture recent_more %}{{ found_page.url | relative_url }}{% endcapture %}{% else %}{% assign recent_more = nil %}{% endif %} + {% include components/section-head.html id="recent-title" heading=recent_heading more_url=recent_more more_label=recent_more_label %} + <ul class="book-grid book-grid--four"> + {%- for recent_post in recent_posts %} + <li> + {% include components/book-card.html entry=recent_post excerpt="clamp" %} + </li> + {%- endfor %} + </ul> + {% include components/pagination.html %} + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/sections/shelves.html b/jekyll/theme/_includes/sections/shelves.html new file mode 100644 index 0000000..a403a24 --- /dev/null +++ b/jekyll/theme/_includes/sections/shelves.html @@ -0,0 +1,38 @@ +{%- comment -%} +The Read, Want to read and Did not finish shelves, in one section. page.year limits +Read to the books finished that year. page.shelves.<status>.note sets the line beside +a shelf's heading, and page.shelves.<status>: false hides that shelf. +{%- endcomment -%} +{%- assign shelves_config = page.shelves -%} +{%- capture shelves_html -%} +{%- assign shelf_statuses = "read,want,dnf" | split: "," -%} +{%- for shelf_status in shelf_statuses -%} +{%- if shelves_config[shelf_status] == false %}{% continue %}{% endif -%} +{%- if shelf_status == "read" -%} +{%- include data/entries.html status="read" year=page.year -%} +{%- else -%} +{%- include data/entries.html status=shelf_status -%} +{%- endif -%} +{%- if entries.size == 0 %}{% continue %}{% endif -%} +{%- assign shelf_key = shelf_status | prepend: "shelf_" -%} +{%- capture shelf_heading -%} +{%- if shelf_status == "read" and page.year %}{% include data/t.html key="shelf_read_year" n=page.year %}{% else %}{% include data/t.html key=shelf_key %}{% endif -%} +{%- endcapture -%} +{%- assign shelf_note = shelves_config[shelf_status].note -%} +{%- if shelf_note == nil and shelf_status == "read" %}{% capture shelf_note %}{% include data/t.html key="shelf_read_note" %}{% endcapture %}{% endif -%} +{%- capture shelf_count %}{% if entries.size == 1 %}{% include data/t.html key="books_one" %}{% else %}{% include data/t.html key="books_many" n=entries.size %}{% endif %}{% endcapture -%} +{%- capture shelf_id %}{{ shelf_status }}-title{% endcapture %} + <div class="shelf-section" aria-labelledby="{{ shelf_id }}"> + {% include components/section-head.html id=shelf_id heading=shelf_heading count=shelf_count note=shelf_note %} + {% include components/shelf.html entries=entries label=shelf_heading %} + </div> +{% endfor -%} +{%- endcapture -%} +{%- assign shelves_check = shelves_html | strip -%} +{%- if shelves_check != "" -%} +<section class="section"> + <div class="wrap"> +{{ shelves_html }} + </div> + </section> +{%- endif -%} diff --git a/jekyll/theme/_includes/shell/credit.html b/jekyll/theme/_includes/shell/credit.html new file mode 100644 index 0000000..b38f2da --- /dev/null +++ b/jekyll/theme/_includes/shell/credit.html @@ -0,0 +1 @@ +<p><a href="https://www.listofbooks.net/">Theme by List of Books</a></p> diff --git a/jekyll/theme/_includes/shell/footer.html b/jekyll/theme/_includes/shell/footer.html new file mode 100644 index 0000000..960d668 --- /dev/null +++ b/jekyll/theme/_includes/shell/footer.html @@ -0,0 +1,27 @@ +{%- assign footer = site.readerly.footer -%} +<footer class="site-footer"> + <div class="wrap"> + <div class="site-footer__grid"> + <div> + <p class="site-title"><a href="{{ "/" | relative_url }}">{{ site.title }}</a></p> + {%- if footer.about %} + <p>{{ footer.about }}</p> + {%- endif %} + </div> + {%- for footer_column in footer.columns %}{% if footer_column.links %} + <nav aria-label="{{ footer_column.title | escape }}"> + <h2>{{ footer_column.title }}</h2> + <ul class="footer-links"> + {%- for footer_link in footer_column.links %} + <li><a href="{% include components/url.html url=footer_link.url %}">{{ footer_link.title }}</a></li> + {%- endfor %} + </ul> + </nav> + {%- endif %}{% endfor %} + </div> + <div class="site-footer__bottom"> + <p>© {{ site.time | date: "%Y" }} {{ site.title }}.{% if footer.copyright %} {{ footer.copyright }}{% endif %}</p> + {% include shell/credit.html %} + </div> + </div> + </footer> diff --git a/jekyll/theme/_includes/shell/head.html b/jekyll/theme/_includes/shell/head.html new file mode 100644 index 0000000..d8a4811 --- /dev/null +++ b/jekyll/theme/_includes/shell/head.html @@ -0,0 +1,47 @@ +{%- assign head_style = site.readerly.style | default: "auto" -%} +{%- capture head_title -%} +{%- if page.layout == "post" and page.book_author -%} +{{ page.book_title | default: page.title }} {% include data/t.html key="by" n=page.book_author %}: {% include data/t.html key="review" %} · {{ site.title }} +{%- elsif page.title and page.url != "/" -%} +{{ page.title }} · {{ site.title }} +{%- elsif site.tagline -%} +{{ site.title }}: {{ site.tagline }} +{%- else -%} +{{ site.title }} +{%- endif -%} +{%- if paginator.page > 1 %} · {% include data/t.html key="page_n" n=paginator.page %}{% endif -%} +{%- endcapture -%} +{%- assign head_description = page.description | default: page.lead | default: page.intro.lead | default: page.excerpt | default: site.description | strip_html | strip_newlines | strip -%} +<meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>{{ head_title | strip_html | strip | escape_once }} + {%- if head_description != "" %} + + {%- endif %} + + + + + + + {%- if head_description != "" %} + + {%- endif %} + {%- if page.cover %} + + {%- endif %} + {%- if site.readerly.favicon %} + + {%- endif %} + + {%- if site.readerly.custom_css %} + + {%- endif %} + {%- if site.plugins contains "jekyll-feed" or site.gems contains "jekyll-feed" %} + + {%- endif %} + {%- if site.readerly.style_toggle != false %} + + {%- endif %} + {%- if page.layout == "post" %}{% include components/review-jsonld.html %}{% endif %} + {%- include head-custom.html %} diff --git a/jekyll/theme/_includes/shell/header.html b/jekyll/theme/_includes/shell/header.html new file mode 100644 index 0000000..59c9c32 --- /dev/null +++ b/jekyll/theme/_includes/shell/header.html @@ -0,0 +1,45 @@ +{%- include data/find-page.html layout="archive" -%} +{%- assign header_archive = found_page -%} +{%- assign header_toggle = true -%} +{%- if site.readerly.style_toggle == false -%}{%- assign header_toggle = false -%}{%- endif -%} + diff --git a/jekyll/theme/_includes/shell/icon.html b/jekyll/theme/_includes/shell/icon.html new file mode 100644 index 0000000..69e96f1 --- /dev/null +++ b/jekyll/theme/_includes/shell/icon.html @@ -0,0 +1,10 @@ +{%- capture icon_path -%} +{%- case include.name -%} +{%- when "search" -%} +{%- when "moon" -%} +{%- when "sun" -%} +{%- when "arrow-left" -%} +{%- else -%} +{%- endcase -%} +{%- endcapture -%} + diff --git a/jekyll/theme/_layouts/archive.html b/jekyll/theme/_layouts/archive.html new file mode 100644 index 0000000..a400c39 --- /dev/null +++ b/jekyll/theme/_layouts/archive.html @@ -0,0 +1,63 @@ +--- +layout: default +--- +{%- comment -%} +Every review, newest first, or with page.genre only the reviews whose genre or tags +include it. filter.js narrows the list by ?s= (search) and ?genre= in the browser. +{%- endcomment -%} +{%- if page.genre -%} +{%- assign archive_posts = "" | split: "" -%} +{%- for archive_post in site.posts -%} +{%- if archive_post.genre == page.genre or archive_post.tags contains page.genre -%}{%- assign archive_posts = archive_posts | push: archive_post -%}{%- endif -%} +{%- endfor -%} +{%- else -%} +{%- assign archive_posts = site.posts -%} +{%- endif -%} +{%- assign archive_related = "" | split: "" -%} +{%- if page.genre -%} +{%- for archive_post in archive_posts -%} +{%- assign archive_terms = archive_post.tags | unshift: archive_post.genre -%} +{%- for archive_term in archive_terms -%} +{%- if archive_term and archive_term != page.genre -%}{%- unless archive_related contains archive_term -%}{%- assign archive_related = archive_related | push: archive_term -%}{%- endunless -%}{%- endif -%} +{%- endfor -%} +{%- endfor -%} +{%- endif -%} +
+
+ {% if page.eyebrow %}{{ page.eyebrow }}{% elsif page.genre %}{% include data/t.html key="genre" %}{% else %}{% include data/t.html key="archive" %}{% endif %} +

{% if page.title or page.genre %}{{ page.title | default: page.genre }}{% else %}{% include data/t.html key="archive" %}{% endif %}

+ {%- if page.lead %} +

{{ page.lead }}

+ {%- endif %} +

{% if archive_posts.size == 1 %}{% include data/t.html key="reviews_one" %}{% else %}{% include data/t.html key="reviews_many" n=archive_posts.size %}{% endif %}

+ {%- if archive_related.size > 0 %} +
    + {%- for archive_term in archive_related %} +
  • {% include components/genre-link.html name=archive_term class="tag" %}
  • + {%- endfor %} +
+ {%- endif %} +
+ {%- assign archive_content = content | strip %} + {%- if archive_content != "" %} +
+{{ content }} +
+ {%- endif %} + + + {%- if archive_posts.size > 0 %} + +
    + {%- for archive_post in archive_posts %} + {%- assign archive_terms = archive_post.tags | unshift: archive_post.genre | compact %} + {%- assign archive_terms_text = archive_terms | join: " " %} + {%- capture archive_search %}{{ archive_post.title }} {{ archive_post.book_title }} {{ archive_post.book_author }} {{ archive_post.series }} {{ archive_terms_text }}{% endcapture %} +
  • + {% include components/book-card.html entry=archive_post variant="list" heading="h2" excerpt="full" %} +
  • + {%- endfor %} +
+ + {%- endif %} +
diff --git a/jekyll/theme/_layouts/author.html b/jekyll/theme/_layouts/author.html new file mode 100644 index 0000000..8b1ab9c --- /dev/null +++ b/jekyll/theme/_layouts/author.html @@ -0,0 +1,4 @@ +--- +layout: sections +sections: [author-hero, new-release, books, praise, events, newsletter] +--- diff --git a/jekyll/theme/_layouts/default.html b/jekyll/theme/_layouts/default.html new file mode 100644 index 0000000..7728d96 --- /dev/null +++ b/jekyll/theme/_layouts/default.html @@ -0,0 +1,18 @@ + +{%- assign default_style = site.readerly.style | default: "auto" %} + + + {% include shell/head.html %} + + + + + {% include shell/header.html %} + +
+{{ content }} +
+ + {% include shell/footer.html %} + + diff --git a/jekyll/theme/_layouts/home.html b/jekyll/theme/_layouts/home.html new file mode 100644 index 0000000..7c655fe --- /dev/null +++ b/jekyll/theme/_layouts/home.html @@ -0,0 +1,5 @@ +--- +layout: sections +sections: [intro, content, featured-review, recent-reviews, currently-reading, genres, newsletter] +--- +{{ content }} diff --git a/jekyll/theme/_layouts/not-found.html b/jekyll/theme/_layouts/not-found.html new file mode 100644 index 0000000..d62da09 --- /dev/null +++ b/jekyll/theme/_layouts/not-found.html @@ -0,0 +1,42 @@ +--- +layout: default +--- +{%- comment -%} +The 404 page: a search form when the site has an archive page, links home, and +up to five recent reviews rated 4 or more. +{%- endcomment -%} +{%- include data/find-page.html layout="archive" -%} +{%- assign nf_archive = found_page -%} +{%- assign nf_picks = "" | split: "" -%} +{%- for nf_post in site.posts -%} +{%- if nf_post.rating >= 4 and nf_picks.size < 5 -%}{%- assign nf_picks = nf_picks | push: nf_post -%}{%- endif -%} +{%- endfor -%} +
+
+ +

{{ page.heading | default: "" }}{% unless page.heading %}{% include data/t.html key="not_found_title" %}{% endunless %}

+

{% if page.lead %}{{ page.lead }}{% elsif nf_archive %}{% include data/t.html key="not_found_lead" %}{% else %}{% include data/t.html key="not_found_lead_no_search" %}{% endif %}

+ {%- if nf_archive %} + + {%- endif %} + +
+ {%- if nf_picks.size > 0 %} + {%- capture nf_heading %}{% include data/t.html key="pick_something" %}{% endcapture %} + {%- capture nf_note %}{% include data/t.html key="recent_favourites" %}{% endcapture %} + +
+ {% include components/section-head.html id="suggest-title" heading=nf_heading note=nf_note %} + {% include components/shelf.html entries=nf_picks label=nf_note %} +
+ {%- endif %} +
diff --git a/jekyll/theme/_layouts/page.html b/jekyll/theme/_layouts/page.html new file mode 100644 index 0000000..d2b29a2 --- /dev/null +++ b/jekyll/theme/_layouts/page.html @@ -0,0 +1,21 @@ +--- +layout: default +--- +{%- comment -%} A page with no title prints no header, so content that brings its own h1 keeps the only one. {%- endcomment %} +
+ {%- if page.title %} +
+ {%- if page.eyebrow %} + {{ page.eyebrow }} + {%- endif %} +

{{ page.title }}

+ {%- if page.lead %} +

{{ page.lead }}

+ {%- endif %} +
+ {%- endif %} + +
+{{ content }} +
+
diff --git a/jekyll/theme/_layouts/post.html b/jekyll/theme/_layouts/post.html new file mode 100644 index 0000000..1c09603 --- /dev/null +++ b/jekyll/theme/_layouts/post.html @@ -0,0 +1,142 @@ +--- +layout: default +--- +{%- comment -%} +A blog post. Each part renders only when its data exists, so a post with no book +keys is a plain article and a post with every key is a full review. +{%- endcomment -%} +{%- assign post_title = page.book_title | default: page.title -%} +{%- assign post_date_format = site.readerly.date_format | default: "%-d %B %Y" -%} +{%- assign post_author_name = page.author.name | default: page.author | default: site.author.name -%} +{%- if page.author.name or page.author == nil %}{% assign post_author_url = page.author.url | default: site.author.url %}{% else %}{% assign post_author_url = nil %}{% endif -%} +{%- assign post_words = content | strip_html | number_of_words -%} +{%- assign post_minutes = post_words | divided_by: 200 | at_least: 1 -%} +{%- assign post_tags = "" | split: "" -%} +{%- if page.genre %}{% assign post_tags = post_tags | push: page.genre %}{% endif -%} +{%- for post_tag in page.tags %}{% unless post_tags contains post_tag %}{% assign post_tags = post_tags | push: post_tag %}{% endunless %}{% endfor -%} +
+
+
+ {%- if post_tags.size > 0 %} +
    + {%- for post_tag in post_tags %} +
  • {% include components/genre-link.html name=post_tag class="tag" %}
  • + {%- endfor %} +
+ {%- endif %} +

{{ page.title }}

+ {%- if page.lead %} +

{{ page.lead }}

+ {%- endif %} + +
+ {%- if page.cover or page.book_author or page.series or page.pages or page.publication or page.rating or page.status %} + + + {%- endif %} + +
+{{ content }} + {%- if page.verdict %} + +
+
+

{% include data/t.html key="my_verdict" %}

+ {%- if page.rating %} +
{% include components/rating.html value=page.rating size="large" %}
+ {%- endif %} +
+ {%- if page.verdict.summary %} +

{{ page.verdict.summary }}

+ {%- endif %} + {%- if page.verdict.liked or page.verdict.disliked %} +
+ {%- if page.verdict.liked %} +
+

{% include data/t.html key="what_worked" %}

+
    + {%- for verdict_item in page.verdict.liked %} +
  • {{ verdict_item }}
  • + {%- endfor %} +
+
+ {%- endif %} + {%- if page.verdict.disliked %} +
+

{% include data/t.html key="less_so" %}

+
    + {%- for verdict_item in page.verdict.disliked %} +
  • {{ verdict_item }}
  • + {%- endfor %} +
+
+ {%- endif %} +
+ {%- endif %} +
+ {%- endif %} +
+ {%- if site.author.name and site.author.bio %} + + + {%- endif %} + {%- include components/related.html %} + {%- include comments.html %} +
+
diff --git a/jekyll/theme/_layouts/reading-log.html b/jekyll/theme/_layouts/reading-log.html new file mode 100644 index 0000000..559e675 --- /dev/null +++ b/jekyll/theme/_layouts/reading-log.html @@ -0,0 +1,4 @@ +--- +layout: sections +sections: [intro-stats, currently-reading, shelves] +--- diff --git a/jekyll/theme/_layouts/sections.html b/jekyll/theme/_layouts/sections.html new file mode 100644 index 0000000..6b3fac1 --- /dev/null +++ b/jekyll/theme/_layouts/sections.html @@ -0,0 +1,13 @@ +--- +layout: default +--- +{%- comment -%} +Renders page.sections, else the calling layout's sections, in order. Each name is +a file in _includes/sections/, so a misspelt name fails the build with an error +that names the missing file. Pages 2 and up of a paginated list show only the reviews. +{%- endcomment -%} +{%- assign section_names = page.sections | default: layout.sections -%} +{%- if paginator.page > 1 -%}{%- assign section_names = "recent-reviews" | split: "," -%}{%- endif -%} +{%- for section_name in section_names %} +{% include sections/{{ section_name }}.html %} +{%- endfor %} diff --git a/jekyll/theme/assets/css/readerly.css b/jekyll/theme/assets/css/readerly.css new file mode 100644 index 0000000..2d8447b --- /dev/null +++ b/jekyll/theme/assets/css/readerly.css @@ -0,0 +1,1402 @@ +/* Readerly for Jekyll. GENERATED by tools/build-tokens.mjs from design/assets/css. Do not edit. */ + +/* + * 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; +} + +/* + * Readerly — design tokens + * --------------------------------------------------------------- + * GENERATED from design/tokens.json by tools/build-tokens.mjs. + * Edit tokens.json and rerun the script; do not edit this file. + * + * Porting map + * WordPress theme.json settings.color.palette -> --color-* + * settings.typography.fontFamilies -> --font-* + * settings.typography.fontSizes -> --size-* + * settings.spacing.spacingSizes -> --space-* + * settings.layout.contentSize/wideSize-> --width-* + * settings.custom -> "supporting values" + * Hugo / Jekyll / Ghost: copy this file as-is. + * + * Light ("Paper") is the default. Dark ("Lamplight") applies through + * prefers-color-scheme, and [data-theme="light" | "dark"] on overrides + * the system. Both modes use the same token names; only the values change. + */ + +:root { + color-scheme: light; + + /* Colour palette — light ("paper") */ + --color-base: #f6f1e7; /* page background: warm paper */ + --color-surface: #fcf9f3; /* cards, panels, inputs */ + --color-contrast: #2a241e; /* body text: warm ink (13.9:1 on base) */ + --color-muted: #675d52; /* meta, captions (5.6:1 on base) */ + --color-accent: #9e3d27; /* links, buttons, stars (5.9:1 on base) */ + --color-accent-2: #4a6650; /* status, tags: sage (5.6:1 on base) */ + --color-border: #ddd3c3; /* hairlines, dividers (decorative only) */ + + /* 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; + + /* Fluid font sizes: min at 360px wide, max at 1280px wide */ + --size-small: clamp(0.875rem, 0.8505rem + 0.1087vw, 0.9375rem); /* 14 -> 15px */ + --size-medium: clamp(1.0625rem, 1.0136rem + 0.2174vw, 1.1875rem); /* 17 -> 19px */ + --size-large: clamp(1.25rem, 1.1522rem + 0.4348vw, 1.5rem); /* 20 -> 24px */ + --size-x-large: clamp(1.625rem, 1.3804rem + 1.087vw, 2.25rem); /* 26 -> 36px */ + --size-xx-large: clamp(2.125rem, 1.587rem + 2.3913vw, 3.5rem); /* 34 -> 56px */ + + /* Spacing scale (4/8 rhythm; the larger steps breathe with the viewport) */ + --space-20: 0.5rem; /* 8px */ + --space-30: 1rem; /* 16px */ + --space-40: 1.5rem; /* 24px */ + --space-50: clamp(2rem, 1.8rem + 0.9vw, 2.5rem); /* 32 -> 40px */ + --space-60: clamp(2.5rem, 2rem + 2.2vw, 4rem); /* 40 -> 64px */ + --space-70: clamp(3.5rem, 2.6rem + 3.6vw, 6rem); /* 56 -> 96px */ + --space-80: clamp(4.5rem, 3rem + 6.2vw, 8rem); /* 72 -> 128px */ + + /* Layout widths */ + --width-content: 680px; + --width-wide: 1200px; + + /* Supporting values (theme.json settings.custom) */ + --line-height-body: 1.7; + --line-height-heading: 1.15; + --radius: 6px; + --radius-cover: 2px 4px 4px 2px; /* a book's spine edge is squarer */ + --border-width: 1px; + --duration: 200ms; + --easing: cubic-bezier(0.23, 1, 0.32, 1); +} + +/* Dark ("lamplight") — same names, independently chosen values. + Kept identical in both blocks below: system preference and explicit override. */ +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + color-scheme: dark; + --color-base: #1b1814; /* warm charcoal */ + --color-surface: #24201b; + --color-contrast: #eee6d8; /* 14.2:1 on base */ + --color-muted: #b3a795; /* 7.4:1 on base */ + --color-accent: #e59a7e; /* 8.0:1 on base */ + --color-accent-2: #9dbfa3; /* 9.1:1 on base */ + --color-border: #3a332b; + } +} + +:root[data-theme="dark"] { + color-scheme: dark; + --color-base: #1b1814; + --color-surface: #24201b; + --color-contrast: #eee6d8; + --color-muted: #b3a795; + --color-accent: #e59a7e; + --color-accent-2: #9dbfa3; + --color-border: #3a332b; +} + +/* + * Readerly — shared stylesheet + * --------------------------------------------------------------- + * Every colour, font, size, space and width comes from tokens.css. + * Sections map to blocks / partials when porting: + * 1. Layout primitives 6. Book components 11. Author site + * 2. Base & typography 7. Grid & shelf 12. Reading log + * 3. Layout helpers 8. Featured review 13. Archive & pagination + * 4. Header & nav 9. Single review 14. Not found + * 5. Buttons & forms 10. Comments 15. Footer + */ + +/* OD-LAYOUT-PRIMITIVES v1 — structure only: display, flex/grid, overflow, wrapping, ratio, geometry. + Put this @layer first; product CSS outside the layer wins ordinary layout rules. + Native hidden and closed-dialog states take precedence over component display rules. */ +@layer od-layout { + [hidden]:not([hidden="until-found" i]) { display: none !important; } + dialog:not([open]) { display: none !important; } + + :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; } + + .od-stack { display: flex; flex-direction: column; gap: var(--od-gap, 8px); } + .od-row { display: flex; align-items: center; gap: var(--od-gap, 8px); } + .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); } + .od-fill { flex: 1 1 0; min-width: 0; } + .od-fixed { flex: none; } + + .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); } + :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; } + + .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); } + + .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1em); block-size: var(--od-icon-size, 1em); flex: none; } + + .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; } + .od-clamp-2 { -webkit-line-clamp: 2; } + .od-clamp-3 { -webkit-line-clamp: 3; } + .od-nowrap { white-space: nowrap; } +} +:root [hidden]:where(:not([hidden="until-found" i])) { display: none; } +/* /OD-LAYOUT-PRIMITIVES v1 */ + + +/* 2. Base & typography ------------------------------------------ */ + +*, *::before, *::after { box-sizing: border-box; } + +html { + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; + scroll-padding-top: var(--space-40); +} + +body { + margin: 0; + background-color: var(--color-base); + background-image: url("../img/paper-grain.svg"); + color: var(--color-contrast); + font-family: var(--font-body); + font-size: var(--size-medium); + line-height: var(--line-height-body); + font-optical-sizing: auto; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; +} + +h1, h2, h3, h4 { + margin: 0; + font-family: var(--font-heading); + font-weight: 500; + line-height: var(--line-height-heading); + letter-spacing: -0.01em; + text-wrap: balance; +} +h1 { font-size: var(--size-xx-large); } +h2 { font-size: var(--size-x-large); } +h3 { font-size: var(--size-large); } +h4 { font-size: var(--size-medium); font-weight: 600; } + +p { margin: 0; text-wrap: pretty; } + +a { + color: var(--color-accent); + text-decoration-line: underline; + text-decoration-thickness: 1px; + text-underline-offset: 0.2em; + transition: text-decoration-thickness var(--duration) var(--easing); +} +a:hover { text-decoration-thickness: 2px; } + +:focus-visible { + outline: 2px solid var(--color-accent); + outline-offset: 3px; + border-radius: 2px; +} + +img, svg { max-width: 100%; } +img { display: block; height: auto; } + +hr, .separator { + height: 0; + margin: var(--space-60) auto; + border: 0; + border-top: var(--border-width) solid var(--color-border); +} +.separator--ornament { + width: 100%; + max-width: 8rem; + border: 0; + text-align: center; + height: auto; +} +.separator--ornament::before { + content: "\2042"; /* asterism */ + color: var(--color-muted); + font-family: var(--font-heading); + font-size: var(--size-large); +} + +ul, ol { margin: 0; padding-left: 1.25em; } +li + li { margin-top: var(--space-20); } + +blockquote { margin: 0; } + +figure { margin: 0; } +figcaption { + margin-top: var(--space-20); + color: var(--color-muted); + font-size: var(--size-small); +} + +small, .has-small-font-size { font-size: var(--size-small); } + +.visually-hidden { + position: absolute !important; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0 0 0 0); + white-space: nowrap; + border: 0; +} + +.skip-link { + position: absolute; + top: var(--space-20); + left: var(--space-20); + z-index: 10; + padding: var(--space-20) var(--space-30); + background: var(--color-contrast); + color: var(--color-base); + font-size: var(--size-small); + text-decoration: none; + border-radius: var(--radius); + transform: translateY(-200%); +} +.skip-link:focus { transform: none; } + +.eyebrow { + display: block; + color: var(--color-accent-2); + font-family: var(--font-body); + font-size: var(--size-small); + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; + line-height: 1.4; +} + +.lead { + font-size: var(--size-large); + line-height: 1.55; +} + +.muted { color: var(--color-muted); } + + +/* 3. Layout helpers --------------------------------------------- */ + +.wrap { + width: 100%; + max-width: calc(var(--width-wide) + 2 * var(--space-40)); + margin-inline: auto; + padding-inline: var(--space-40); +} +.wrap--content { max-width: calc(var(--width-content) + 2 * var(--space-40)); } + +@media (max-width: 480px) { + .wrap { padding-inline: var(--space-30); } + .wrap--content { max-width: calc(var(--width-content) + 2 * var(--space-30)); } +} + +.section { padding-block: var(--space-70); } +.section--tight { padding-block: var(--space-60); } +.section + .section { padding-top: 0; } +.section--band { + background-color: var(--color-surface); + border-block: var(--border-width) solid var(--color-border); +} +.section + .section--band, .section--band + .section { padding-top: var(--space-70); } + +.section-head { + display: flex; + flex-wrap: wrap; + align-items: baseline; + justify-content: space-between; + gap: var(--space-20) var(--space-40); + margin-bottom: var(--space-50); + padding-bottom: var(--space-30); + border-bottom: var(--border-width) solid var(--color-border); +} +.section-head p { color: var(--color-muted); font-size: var(--size-small); } + +.more-link { + display: inline-flex; + align-items: center; + gap: 0.35em; + font-size: var(--size-small); + font-weight: 600; + text-decoration: none; +} +.more-link:hover { text-decoration: underline; } + +/* Columns block: stacks below 768px */ +.columns { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--space-50); +} +@media (min-width: 768px) { + .columns--equal { grid-template-columns: repeat(2, minmax(0, 1fr)); } + .columns--1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } + .columns--2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } + .columns--thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); } + .columns--center { align-items: center; } +} + +/* Flow spacing for stacked text groups */ +.flow > * + * { margin-top: var(--space-30); } +.flow-lg > * + * { margin-top: var(--space-40); } + + +/* 4. Header & nav ----------------------------------------------- */ + +.site-header { + border-bottom: var(--border-width) solid var(--color-border); +} + +.site-header__bar { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: var(--space-30) var(--space-40); + padding-block: var(--space-40) var(--space-30); +} + +.site-branding { min-width: 0; } + +.site-title { + font-family: var(--font-heading); + font-size: var(--size-x-large); + font-weight: 500; + line-height: 1.1; + letter-spacing: -0.015em; +} +.site-title a { color: var(--color-contrast); text-decoration: none; } +.site-title a:hover { color: var(--color-accent); } + +.site-tagline { + margin-top: 0.25em; + color: var(--color-muted); + font-size: var(--size-small); + font-style: italic; +} + +.site-tools { + display: flex; + align-items: center; + gap: var(--space-20); + flex: 0 1 22rem; + min-width: 0; +} +@media (max-width: 640px) { + .site-tools { flex-basis: 100%; } +} +.site-tools--compact { flex: none; } +@media (max-width: 640px) { + .site-tools--compact { flex-basis: auto; } +} + +/* Site nav wraps instead of scrolling, so no label is ever clipped */ +.site-nav ul { + display: flex; + flex-wrap: wrap; + gap: 0 var(--space-40); + margin: 0; + padding: 0 0 var(--space-30); + list-style: none; +} +.site-nav li { margin: 0; } +@media (max-width: 480px) { + .site-nav ul { column-gap: var(--space-30); } +} +.site-nav a { + display: inline-block; + padding-block: var(--space-20); + color: var(--color-contrast); + font-size: var(--size-small); + font-weight: 500; + text-decoration: none; + border-bottom: 2px solid transparent; + transition: border-color var(--duration) var(--easing), color var(--duration) var(--easing); +} +.site-nav a:hover { color: var(--color-accent); border-bottom-color: var(--color-border); } +.site-nav a[aria-current="page"] { + color: var(--color-accent); + border-bottom-color: var(--color-accent); +} + +.icon-button { + display: inline-grid; + place-items: center; + flex: none; + width: 44px; + height: 44px; + padding: 0; + border: var(--border-width) solid var(--color-border); + border-radius: var(--radius); + background: var(--color-surface); + color: var(--color-contrast); + cursor: pointer; + --od-icon-size: 1.25rem; + transition: border-color var(--duration) var(--easing), color var(--duration) var(--easing); +} +.icon-button:hover { border-color: var(--color-contrast); color: var(--color-accent); } + +.theme-toggle .icon-sun { display: none; } +.theme-toggle[aria-pressed="true"] .icon-sun { display: inline-block; } +.theme-toggle[aria-pressed="true"] .icon-moon { display: none; } + + +/* 5. Buttons & forms -------------------------------------------- */ + +.buttons { + display: flex; + flex-wrap: wrap; + gap: var(--space-20) var(--space-30); +} + +.button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 0.5em; + min-height: 44px; + padding: 0.5em 1.25em; + border: var(--border-width) solid var(--color-accent); + border-radius: var(--radius); + background: var(--color-accent); + color: var(--color-base); + font-family: var(--font-body); + font-size: var(--size-small); + font-weight: 600; + line-height: 1.2; + text-decoration: none; + cursor: pointer; + transition: background-color var(--duration) var(--easing), border-color var(--duration) var(--easing), color var(--duration) var(--easing); +} +.button:hover { + background: var(--color-contrast); + border-color: var(--color-contrast); + color: var(--color-base); +} +.button--outline { + background: transparent; + border-color: var(--color-contrast); + color: var(--color-contrast); +} +.button--outline:hover { + background: var(--color-contrast); + color: var(--color-base); +} +.button:disabled, .button[aria-disabled="true"] { + background: var(--color-border); + border-color: var(--color-border); + color: var(--color-muted); + cursor: not-allowed; +} + +.field { display: grid; gap: var(--space-20); } +.field + .field { margin-top: var(--space-30); } + +label, .label { + font-size: var(--size-small); + font-weight: 600; +} +.label-note { color: var(--color-muted); font-weight: 400; } + +.input, textarea.input { + width: 100%; + min-height: 44px; + padding: 0.55em 0.85em; + border: var(--border-width) solid var(--color-muted); + border-radius: var(--radius); + background: var(--color-surface); + color: var(--color-contrast); + font: inherit; + font-size: var(--size-medium); + line-height: 1.4; +} +textarea.input { min-height: 8rem; resize: vertical; } +.input::placeholder { color: var(--color-muted); opacity: 1; } +.input:focus-visible { outline-offset: 1px; border-color: var(--color-accent); } + +.search-form { + display: flex; + flex: 1 1 auto; + min-width: 0; +} +.search-form .input { + flex: 1 1 auto; + min-width: 0; + border-right: 0; + border-radius: var(--radius) 0 0 var(--radius); + font-size: var(--size-small); +} +.search-form .icon-button { + border-color: var(--color-muted); + border-radius: 0 var(--radius) var(--radius) 0; +} + +.form-status:empty { display: none; } +.form-status { + margin-top: var(--space-30); + color: var(--color-accent-2); + font-size: var(--size-small); + font-weight: 600; +} + + +/* 6. Book components -------------------------------------------- */ + +/* Cover image: always the full 2:3 frame, never cropped */ +.cover { + display: block; + width: 100%; + height: auto; + border-radius: var(--radius-cover); + --cover-edge: 0 0 0 0 transparent; + box-shadow: var(--cover-edge), 0 1px 2px rgb(42 36 30 / 0.18), 0 6px 14px -8px rgb(42 36 30 / 0.35); +} + +/* Dark mode: a faint 1px edge keeps dark covers from dissolving into the page */ +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) .cover { --cover-edge: 0 0 0 1px color-mix(in srgb, var(--color-contrast) 24%, transparent); } +} +:root[data-theme="dark"] .cover { --cover-edge: 0 0 0 1px color-mix(in srgb, var(--color-contrast) 24%, transparent); } + +/* CSS-only fallback cover for books without an image. + Mirrors the SVG covers (400 x 600): title from the top at 46/400 of the width, + author in spaced capitals near the foot, spine shading and the same grain. */ +.cover--placeholder { + container-type: inline-size; + display: flex; + flex-direction: column; + justify-content: space-between; + aspect-ratio: 2 / 3; + padding: 16% 9% 12%; + background-color: var(--color-accent-2); + background-image: + linear-gradient(90deg, rgb(0 0 0 / 0.14) 0 3%, rgb(255 255 255 / 0.12) 3% 3.5%, transparent 3.5%), + url("../img/cover-grain.svg"); + background-size: 100% 100%, 100% 100%; + color: var(--color-base); + font-family: var(--font-heading); + text-align: center; +} +.cover--placeholder strong { + font-size: 1.6rem; + font-size: 11.5cqi; + font-weight: 500; + line-height: 1.12; + letter-spacing: 0.01em; + text-wrap: balance; +} +.cover--placeholder span { + font-size: 0.6rem; + font-size: 4.25cqi; + letter-spacing: 0.2em; + line-height: 1.2; + text-transform: uppercase; +} + +.cover-link { + display: block; + transition: transform var(--duration) var(--easing); +} +.cover-link:hover { transform: translateY(-3px); } + +/* Star rating — set --rating (0–5, halves allowed) */ +.rating { + --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.8 6 6.5.7-4.9 4.4 1.4 6.4L12 16.8 6.2 20.1l1.4-6.4L2.7 9.3l6.5-.7z'/%3E%3C/svg%3E"); + display: inline-block; + flex: none; + width: 5.5em; + height: 1.1em; + font-size: 1rem; + vertical-align: -0.15em; + background: linear-gradient(90deg, var(--color-accent) calc(var(--rating, 0) / 5 * 100%), var(--color-border) 0); + -webkit-mask: var(--star) 0 0 / 1.1em 1.1em repeat-x; + mask: var(--star) 0 0 / 1.1em 1.1em repeat-x; +} +.rating--large { font-size: 1.375rem; } +.rating-line { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--space-20); + font-size: var(--size-small); + color: var(--color-muted); +} + +/* Status badge — text label is always present, colour only reinforces */ +.badge { + display: inline-flex; + align-items: center; + gap: 0.4em; + padding: 0.2em 0.6em; + border: var(--border-width) solid currentColor; + border-radius: var(--radius); + font-size: 0.8125rem; + font-weight: 600; + line-height: 1.4; + white-space: nowrap; +} +.badge::before { + content: ""; + width: 0.5em; + height: 0.5em; + border: 1.5px solid currentColor; + border-radius: 50%; +} +.badge--reading { color: var(--color-accent-2); } +.badge--reading::before { background: currentColor; } +.badge--read { background: var(--color-accent-2); border-color: var(--color-accent-2); color: var(--color-base); } +.badge--read::before { border-radius: 1px; background: currentColor; } +.badge--want { color: var(--color-muted); border-style: dashed; } +.badge--dnf { color: var(--color-accent); } +.badge--dnf::before { border-radius: 0; width: 0.6em; height: 0; border-width: 1.5px 0 0; } + +/* Book card — full (grid tile) */ +.book-card { + display: grid; + grid-template-rows: auto 1fr; + gap: var(--space-30); + min-width: 0; +} +.book-card__body { display: grid; align-content: start; gap: var(--space-20); min-width: 0; } +.book-card__title { + font-size: var(--size-large); + line-height: 1.2; +} +.book-card__title a { color: var(--color-contrast); text-decoration: none; } +.book-card__title a:hover { color: var(--color-accent); text-decoration: underline; text-decoration-thickness: 1px; } +.book-card__author { color: var(--color-muted); font-size: var(--size-small); } +.book-card__excerpt { font-size: var(--size-small); line-height: 1.6; } +.book-card__meta { + color: var(--color-muted); + font-size: var(--size-small); +} + +/* Book card — compact (row: small cover + details) */ +.book-card--compact { + grid-template-rows: none; + grid-template-columns: 4.5rem minmax(0, 1fr); + align-items: start; + gap: var(--space-30); +} +.book-card--compact .book-card__title { font-size: var(--size-medium); font-weight: 600; } +.book-card--compact .book-card__body { gap: 0.35rem; } +.book-card--compact .rating-line { margin-top: 0.25rem; } + +/* Reading progress */ +.progress { display: grid; gap: 0.35rem; margin-top: var(--space-20); } +.progress progress { + -webkit-appearance: none; + appearance: none; + width: 100%; + height: 6px; + border: 0; + border-radius: 3px; + background: var(--color-border); + color: var(--color-accent-2); + overflow: hidden; +} +.progress progress::-webkit-progress-bar { background: var(--color-border); } +.progress progress::-webkit-progress-value { background: var(--color-accent-2); } +.progress progress::-moz-progress-bar { background: var(--color-accent-2); } +.progress__label { + display: flex; + justify-content: space-between; + gap: var(--space-20); + color: var(--color-muted); + font-size: var(--size-small); +} + + +/* 7. Book grid & horizontal shelf ------------------------------- */ + +/* Query-loop style grid */ +.book-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); + gap: var(--space-60) var(--space-50); + margin: 0; + padding: 0; + list-style: none; +} +.book-grid > li { display: grid; margin: 0; } + +/* Fixed four-up grid: 2 columns on small screens, 4 from 900px */ +.book-grid--four { grid-template-columns: repeat(2, minmax(0, 1fr)); } +@media (min-width: 900px) { + .book-grid--four { grid-template-columns: repeat(4, minmax(0, 1fr)); } +} +.book-grid--compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: var(--space-40) var(--space-50); } +.book-grid--narrow-covers .book-card__cover { max-width: 12rem; } +@media (max-width: 480px) { + .book-grid--four { gap: var(--space-50) var(--space-30); } + .book-grid--four .book-card:not(.book-card--author) .book-card__excerpt { display: none; } +} + +/* List variant: same cards, cover beside text */ +.book-grid--list { grid-template-columns: minmax(0, 1fr); gap: 0; } +.book-grid--list > li { padding-block: var(--space-50); border-bottom: var(--border-width) solid var(--color-border); } +.book-grid--list > li:first-child { padding-top: 0; } +.book-grid--list .book-card { + grid-template-rows: none; + grid-template-columns: 6rem minmax(0, 1fr); + gap: var(--space-40); +} +@media (min-width: 768px) { + .book-grid--list .book-card { grid-template-columns: 9rem minmax(0, 1fr); gap: var(--space-50); } + .book-grid--list .book-card__excerpt { font-size: var(--size-medium); } +} + +/* Horizontal shelf: covers stand on a continuous ledge */ +.shelf { + --shelf-pad: var(--space-30); + display: flex; + margin: 0; + padding: 0 0 var(--space-30); + list-style: none; + overflow-x: auto; + scroll-snap-type: x proximity; + scrollbar-width: thin; + scrollbar-color: var(--color-border) transparent; +} +.shelf > li { + flex: none; + width: calc(9rem + 2 * var(--shelf-pad)); + margin: 0; + padding-inline: var(--shelf-pad); + scroll-snap-align: start; +} +.shelf > li:first-child { padding-left: 0; width: calc(9rem + var(--shelf-pad)); } +.shelf .book-card--compact { + grid-template-columns: minmax(0, 1fr); + gap: var(--space-30); +} +.shelf .book-card__cover { + margin-inline: calc(-1 * var(--shelf-pad)); + padding: 0 var(--shelf-pad) var(--space-20); + border-bottom: 6px solid var(--color-border); +} +.shelf > li:first-child .book-card__cover { margin-left: 0; padding-left: 0; } +.shelf .book-card__title { font-size: var(--size-small); } +.shelf:focus-visible { outline-offset: 6px; } + + +/* 8. Intro & featured review ------------------------------------ */ + +.intro { + display: grid; + gap: var(--space-40); + max-width: 52rem; +} +.intro h1 { font-size: var(--size-xx-large); font-weight: 400; } +.intro h1 em { color: var(--color-accent); font-style: italic; } + +.feature { + display: grid; + gap: var(--space-50); + padding: var(--space-50); + background: var(--color-surface); + border: var(--border-width) solid var(--color-border); + border-radius: var(--radius); +} +@media (min-width: 768px) { + .feature { + grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr); + align-items: center; + padding: var(--space-60); + gap: var(--space-60); + } +} +@media (max-width: 767px) { + .feature .cover-link { max-width: 14rem; } +} +.feature__body { display: grid; gap: var(--space-30); justify-items: start; } +.feature__title { font-size: var(--size-xx-large); } +.feature__title a { color: var(--color-contrast); text-decoration: none; } +.feature__title a:hover { color: var(--color-accent); } + +/* Table-of-contents list with dotted leaders (categories) */ +.toc { + margin: 0; + padding: 0; + list-style: none; + columns: 2 16rem; + column-gap: var(--space-60); +} +.toc li { margin: 0; break-inside: avoid; } +.toc a { + display: flex; + align-items: baseline; + gap: var(--space-20); + min-height: 44px; + padding-block: var(--space-20); + color: var(--color-contrast); + text-decoration: none; +} +.toc a::after { + content: ""; + order: 1; + flex: 1 1 auto; + border-bottom: 1px dotted var(--color-muted); + transform: translateY(-0.3em); +} +.toc__name { font-family: var(--font-heading); font-size: var(--size-large); } +.toc__count { order: 2; color: var(--color-muted); font-size: var(--size-small); font-variant-numeric: tabular-nums; } +.toc a:hover .toc__name { color: var(--color-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; } + +/* Tag chips */ +.tags { + display: flex; + flex-wrap: wrap; + gap: var(--space-20); + margin: 0; + padding: 0; + list-style: none; +} +.tags li { margin: 0; } +.tag { + display: inline-flex; + align-items: center; + min-height: 32px; + padding: 0.15em 0.7em; + border: var(--border-width) solid var(--color-border); + border-radius: var(--radius); + background: var(--color-surface); + color: var(--color-accent-2); + font-size: var(--size-small); + font-weight: 600; + text-decoration: none; +} +.tag:hover { border-color: var(--color-accent-2); } + +/* Newsletter */ +.newsletter { + display: grid; + gap: var(--space-40) var(--space-60); + align-items: end; +} +@media (min-width: 900px) { + .newsletter { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } +} +.newsletter__intro { display: grid; gap: var(--space-30); } +.newsletter__form { display: grid; gap: var(--space-20); } +.newsletter__row { display: flex; flex-wrap: wrap; gap: var(--space-20); } +.newsletter__row .input { flex: 1 1 14rem; } +.newsletter__row .button { flex: 0 0 auto; } +.newsletter__note { margin-top: var(--space-20); color: var(--color-muted); font-size: var(--size-small); } + + +/* 9. Single review ---------------------------------------------- */ + +.entry-header { + display: grid; + gap: var(--space-30); + padding-top: var(--space-70); +} +.entry-meta { + display: flex; + flex-wrap: wrap; + gap: var(--space-20) var(--space-30); + color: var(--color-muted); + font-size: var(--size-small); +} +.entry-meta > * + *::before { + content: "\00B7"; + margin-right: var(--space-30); +} + +/* Book details panel */ +.book-panel { + display: grid; + grid-template-columns: 7rem minmax(0, 1fr); + gap: var(--space-40); + margin-block: var(--space-60); + padding: var(--space-40); + background: var(--color-surface); + border: var(--border-width) solid var(--color-border); + border-radius: var(--radius); +} +@media (min-width: 600px) { + .book-panel { grid-template-columns: 10rem minmax(0, 1fr); gap: var(--space-50); padding: var(--space-50); } +} +.book-panel__title { font-size: var(--size-large); } +.book-panel__author { color: var(--color-muted); font-size: var(--size-small); margin-top: 0.25rem; } +.details { + display: grid; + grid-template-columns: max-content minmax(0, 1fr); + gap: var(--space-20) var(--space-30); + margin: var(--space-30) 0 0; + font-size: var(--size-small); +} +.details dt { color: var(--color-muted); } +.details dd { margin: 0; } +@media (max-width: 420px) { + .details { grid-template-columns: minmax(0, 1fr); gap: 0; } + .details dd + dt { margin-top: var(--space-20); } +} + +/* Long-form body */ +.entry-content > * + * { margin-top: var(--space-40); } +.entry-content > h2 { margin-top: var(--space-60); } +.entry-content > h3 { margin-top: var(--space-50); } +.entry-content > :is(h2, h3) + * { margin-top: var(--space-30); } +.entry-content > p:first-child::first-letter { + float: left; + margin: 0.08em 0.1em 0 0; + color: var(--color-accent); + font-family: var(--font-heading); + font-size: 3.4em; + line-height: 0.85; +} +.entry-content figure img { border-radius: var(--radius); } + +.pullquote { + margin-block: var(--space-60); + padding-block: var(--space-40); + border-block: var(--border-width) solid var(--color-contrast); + text-align: center; +} +.pullquote p { + font-family: var(--font-heading); + font-size: var(--size-x-large); + font-style: italic; + font-weight: 400; + line-height: 1.3; + text-wrap: balance; +} +.pullquote cite { + display: block; + margin-top: var(--space-30); + color: var(--color-muted); + font-size: var(--size-small); + font-style: normal; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +blockquote.quote { + padding-left: var(--space-40); + border-left: 2px solid var(--color-border); + font-style: italic; +} + +/* Verdict summary */ +.verdict { + display: grid; + gap: var(--space-40); + margin-block: var(--space-60); + padding: var(--space-50); + border: var(--border-width) solid var(--color-contrast); + border-radius: var(--radius); +} +.verdict__head { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: var(--space-20) var(--space-30); +} +.verdict__summary { font-family: var(--font-heading); font-size: var(--size-large); line-height: 1.35; } +.verdict__lists { display: grid; gap: var(--space-40); } +@media (min-width: 600px) { .verdict__lists { grid-template-columns: repeat(2, minmax(0, 1fr)); } } +.verdict__lists ul { font-size: var(--size-small); } +.verdict__lists h3 { font-size: var(--size-medium); margin-bottom: var(--space-20); } + +.rating-key { padding: 0; list-style: none; } +.rating-key li { + display: grid; + grid-template-columns: 7.5rem minmax(0, 1fr); + gap: var(--space-30); + align-items: baseline; +} +.figure-portrait img { max-width: 16rem; border-radius: 50%; } + +/* Author bio card */ +.bio-card { + margin-top: var(--space-60); + display: grid; + grid-template-columns: 5rem minmax(0, 1fr); + gap: var(--space-40); + align-items: start; + padding-block: var(--space-50); + border-block: var(--border-width) solid var(--color-border); +} +@media (min-width: 600px) { .bio-card { grid-template-columns: 7rem minmax(0, 1fr); } } +.bio-card img { border-radius: 50%; } +.bio-card__body { display: grid; gap: var(--space-20); } +.bio-card__name { font-size: var(--size-large); } +.bio-card p { font-size: var(--size-small); line-height: 1.65; } + + +/* 10. Comments -------------------------------------------------- */ + +.comments { padding-top: var(--space-60); } + +.comment-list, .comment-list ol { margin: 0; padding: 0; list-style: none; } +.comment-list > li { margin: 0; padding-block: var(--space-40); border-bottom: var(--border-width) solid var(--color-border); } +.comment-list ol { margin-top: var(--space-40); padding-left: var(--space-50); border-left: var(--border-width) solid var(--color-border); } +.comment-list ol li { margin: 0; } +.comment { + display: grid; + grid-template-columns: 2.75rem minmax(0, 1fr); + gap: var(--space-30); +} +.comment__body { display: grid; gap: var(--space-20); font-size: var(--size-small); line-height: 1.65; } +.comment__meta { display: flex; flex-wrap: wrap; gap: 0 var(--space-30); align-items: baseline; } +.comment__author { font-weight: 600; font-size: var(--size-small); } +.comment__date { color: var(--color-muted); font-size: 0.8125rem; } +.comment__reply { font-size: 0.8125rem; font-weight: 600; } + +.avatar { + display: grid; + place-items: center; + width: 2.75rem; + height: 2.75rem; + border-radius: 50%; + background: var(--color-accent-2); + color: var(--color-base); + font-family: var(--font-heading); + font-size: var(--size-small); + font-weight: 600; +} +.avatar--alt { background: var(--color-accent); } +.avatar--author { background: var(--color-contrast); } + +.comment-form { margin-top: var(--space-50); } +.comment-form .buttons { margin-top: var(--space-40); } + + +/* 11. Author site ----------------------------------------------- */ + +.author-hero { + display: grid; + gap: var(--space-50); + align-items: center; +} +@media (min-width: 768px) { + .author-hero { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-70); } +} +.author-hero__portrait img { border-radius: var(--radius); width: 100%; } +@media (max-width: 767px) { .author-hero__portrait { max-width: 22rem; } } +.author-hero__body { display: grid; gap: var(--space-40); justify-items: start; } +.author-hero__body h1 { font-size: clamp(2.5rem, 1.8rem + 3vw, 4.5rem); font-weight: 400; } + +.release { + display: grid; + gap: var(--space-50); + align-items: center; +} +@media (min-width: 768px) { + .release { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-70); } + .release__cover { order: 2; } +} +.release__cover { max-width: 22rem; width: 100%; justify-self: center; } +.release__body { display: grid; gap: var(--space-30); justify-items: start; } +.release__body h2 { font-size: var(--size-xx-large); } +.release__facts { color: var(--color-muted); font-size: var(--size-small); } + +.where-to-buy { + display: grid; + gap: var(--space-30); + margin-top: var(--space-60); + padding-top: var(--space-40); + border-top: var(--border-width) solid var(--color-border); +} +.where-to-buy ul { display: grid; gap: var(--space-20) var(--space-50); padding-left: 1.25em; font-size: var(--size-small); } +.where-to-buy li { margin: 0; } +@media (min-width: 768px) { .where-to-buy ul { grid-template-columns: repeat(3, minmax(0, 1fr)); } } + +.book-grid--related { grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); } +/* Author book card: equal heights, actions pinned to the bottom on one row */ +.book-card--author .book-card__body { + display: flex; + flex-direction: column; + gap: var(--space-20); +} +.book-card__actions { + display: flex; + flex-wrap: wrap; + gap: var(--space-20); + margin-top: auto; + padding-top: var(--space-20); +} +.book-card__actions .button { padding-inline: 0.9em; white-space: nowrap; } + +.praise { + display: grid; + gap: var(--space-50); + margin: 0; + padding: 0; + list-style: none; +} +@media (min-width: 768px) { .praise { grid-template-columns: repeat(3, minmax(0, 1fr)); } } +.praise li { margin: 0; } +.praise figure { display: grid; gap: var(--space-30); padding-top: var(--space-30); border-top: 2px solid var(--color-contrast); } +.praise blockquote p { font-family: var(--font-heading); font-size: var(--size-large); font-style: italic; line-height: 1.4; } +.praise figcaption { margin: 0; } +.praise figcaption strong { display: block; color: var(--color-contrast); font-size: var(--size-small); } + +.events { margin: 0; padding: 0; list-style: none; } +.events li { margin: 0; } +.event { + display: grid; + grid-template-columns: 4.5rem minmax(0, 1fr); + gap: var(--space-40); + align-items: center; + padding-block: var(--space-40); + border-bottom: var(--border-width) solid var(--color-border); +} +.events li:first-child .event { border-top: var(--border-width) solid var(--color-border); } +@media (min-width: 640px) { + .event { grid-template-columns: 5rem minmax(0, 1fr) auto; } +} +@media (max-width: 639px) { + .event .button { grid-column: 2; justify-self: start; } +} +.event__date { + display: grid; + justify-items: center; + align-self: start; + padding: var(--space-20); + border: var(--border-width) solid var(--color-contrast); + border-radius: var(--radius); + line-height: 1.1; +} +.event__day { font-family: var(--font-heading); font-size: var(--size-x-large); } +.event__month { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; } +.event__title { font-size: var(--size-large); } +.event__where { color: var(--color-muted); font-size: var(--size-small); } + + +/* 12. Reading log ----------------------------------------------- */ + +.stats { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); + gap: var(--space-40); + margin: 0; + padding: var(--space-40) 0 0; + list-style: none; + border-top: var(--border-width) solid var(--color-border); +} +.stats li { margin: 0; } +.intro + .stats { margin-top: var(--space-50); } +.stats .od-stat { gap: 0.25rem; } +.stats__number { + font-family: var(--font-heading); + font-size: clamp(2.25rem, 1.8rem + 2vw, 3.25rem); + line-height: 1; + white-space: nowrap; + font-variant-numeric: lining-nums; +} +.stats__label { color: var(--color-muted); font-size: var(--size-small); } + +.shelf-section + .shelf-section { margin-top: var(--space-70); } +.shelf-section .section-head { margin-bottom: var(--space-40); } +.count { color: var(--color-muted); font-family: var(--font-body); font-size: var(--size-small); font-weight: 400; } + + + +/* 13. Archive & pagination -------------------------------------- */ + +.archive-header { + display: grid; + gap: var(--space-30); + padding-block: var(--space-70) var(--space-50); +} +.archive-header p { color: var(--color-muted); } + +.search-note { + margin-bottom: var(--space-50); + padding: var(--space-30) var(--space-40); + background: var(--color-surface); + border: var(--border-width) solid var(--color-border); + border-radius: var(--radius); + font-size: var(--size-small); +} + +.pagination { margin-top: var(--space-60); } +.pagination ul { + display: flex; + flex-wrap: wrap; + justify-content: center; + align-items: center; + gap: var(--space-20); + margin: 0; + padding: 0; + list-style: none; +} +.pagination li { margin: 0; } +.pagination li > a, .pagination li > span { + display: inline-grid; + place-items: center; + min-width: 44px; + min-height: 44px; + padding-inline: var(--space-30); + border: var(--border-width) solid transparent; + border-radius: var(--radius); + color: var(--color-contrast); + font-size: var(--size-small); + text-decoration: none; +} +.pagination li > a:hover { border-color: var(--color-contrast); } +.pagination [aria-current="page"] { + background: var(--color-contrast); + color: var(--color-base); + font-weight: 600; +} +.pagination .pagination__dir { display: inline-flex; align-items: center; gap: 0.4em; font-weight: 600; } +.pagination .is-disabled { color: var(--color-muted); font-weight: 400; } + + +/* 14. Not found ------------------------------------------------- */ + +.not-found { + display: grid; + gap: var(--space-40); + justify-items: start; + padding-block: var(--space-80) var(--space-60); +} +.not-found__code { + font-family: var(--font-heading); + font-size: clamp(5rem, 3rem + 10vw, 10rem); + font-weight: 300; + font-style: italic; + line-height: 0.9; + color: var(--color-accent); +} +.not-found .search-form { width: 100%; max-width: 32rem; } +.not-found .search-form .input { font-size: var(--size-medium); } +.not-found .search-form .icon-button { width: auto; padding-inline: var(--space-40); gap: var(--space-20); display: inline-flex; font: inherit; font-size: var(--size-small); font-weight: 600; } + + +/* 15. Footer ---------------------------------------------------- */ + +/* Pages that end in plain content get one section of breathing room; + pages that end in a section already carry their own bottom padding. */ +main > :last-child:not(.section) { margin-bottom: var(--space-70); } +main:has(> .section--band:last-child) + .site-footer { border-top: 0; } + +.site-footer { + margin-top: 0; + padding-block: var(--space-60) var(--space-40); + border-top: var(--border-width) solid var(--color-border); + font-size: var(--size-small); +} +.site-footer__grid { + display: grid; + gap: var(--space-50); +} +@media (min-width: 768px) { + .site-footer__grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); } +} +.site-footer h2 { + margin-bottom: var(--space-30); + font-family: var(--font-body); + font-size: var(--size-small); + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--color-muted); +} +.site-footer .site-title { font-size: var(--size-large); margin-bottom: var(--space-20); } +.site-footer p { color: var(--color-muted); max-width: 32rem; } +.footer-links { margin: 0; padding: 0; list-style: none; } +.footer-links li + li { margin-top: 0.25rem; } +.footer-links a { color: var(--color-contrast); text-decoration: none; display: inline-block; padding-block: 0.3rem; } +.footer-links a:hover { color: var(--color-accent); text-decoration: underline; } +.site-footer__bottom { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: var(--space-20) var(--space-40); + margin-top: var(--space-60); + padding-top: var(--space-40); + border-top: var(--border-width) solid var(--color-border); + color: var(--color-muted); +} +.site-footer__bottom a { color: var(--color-muted); } +.site-footer__bottom a:hover { color: var(--color-contrast); } + + +/* Motion preferences -------------------------------------------- */ + +@media (prefers-reduced-motion: reduce) { + *, *::before, *::after { + transition-duration: 0.01ms !important; + animation-duration: 0.01ms !important; + scroll-behavior: auto !important; + } + .cover-link:hover { transform: none; } +} diff --git a/jekyll/theme/assets/fonts/fraunces/OFL.txt b/jekyll/theme/assets/fonts/fraunces/OFL.txt new file mode 100644 index 0000000..1dd6478 --- /dev/null +++ b/jekyll/theme/assets/fonts/fraunces/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Fraunces Project Authors (github.com/undercasetype/Fraunces) Fraunces-Italic[SOFT,WONK,opsz,wght].ttf: Copyright 2020 The Fraunces Project Authors (github.com/undercasetype/Fraunces) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/jekyll/theme/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 new file mode 100644 index 0000000..2e65049 Binary files /dev/null and b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 differ diff --git a/jekyll/theme/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 new file mode 100644 index 0000000..b6e3e3a Binary files /dev/null and b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 differ diff --git a/jekyll/theme/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 new file mode 100644 index 0000000..b2cf648 Binary files /dev/null and b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 differ diff --git a/jekyll/theme/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 new file mode 100644 index 0000000..cb295bf Binary files /dev/null and b/jekyll/theme/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 differ diff --git a/jekyll/theme/assets/fonts/literata/OFL.txt b/jekyll/theme/assets/fonts/literata/OFL.txt new file mode 100644 index 0000000..5030063 --- /dev/null +++ b/jekyll/theme/assets/fonts/literata/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2017 The Literata Project Authors (https://github.com/googlefonts/literata) Literata-Italic[opsz,wght].ttf: Copyright 2017 The Literata Project Authors (https://github.com/googlefonts/literata) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/jekyll/theme/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 b/jekyll/theme/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 new file mode 100644 index 0000000..4ae2494 Binary files /dev/null and b/jekyll/theme/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 differ diff --git a/jekyll/theme/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 b/jekyll/theme/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 new file mode 100644 index 0000000..1339f9f Binary files /dev/null and b/jekyll/theme/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 differ diff --git a/jekyll/theme/assets/fonts/literata/literata-latin-standard-italic.woff2 b/jekyll/theme/assets/fonts/literata/literata-latin-standard-italic.woff2 new file mode 100644 index 0000000..87975e1 Binary files /dev/null and b/jekyll/theme/assets/fonts/literata/literata-latin-standard-italic.woff2 differ diff --git a/jekyll/theme/assets/fonts/literata/literata-latin-standard-normal.woff2 b/jekyll/theme/assets/fonts/literata/literata-latin-standard-normal.woff2 new file mode 100644 index 0000000..1f3f137 Binary files /dev/null and b/jekyll/theme/assets/fonts/literata/literata-latin-standard-normal.woff2 differ diff --git a/jekyll/theme/assets/img/cover-grain.svg b/jekyll/theme/assets/img/cover-grain.svg new file mode 100644 index 0000000..e63a3b8 --- /dev/null +++ b/jekyll/theme/assets/img/cover-grain.svg @@ -0,0 +1 @@ + diff --git a/jekyll/theme/assets/img/paper-grain.svg b/jekyll/theme/assets/img/paper-grain.svg new file mode 100644 index 0000000..3138c08 --- /dev/null +++ b/jekyll/theme/assets/img/paper-grain.svg @@ -0,0 +1 @@ + diff --git a/jekyll/theme/assets/js/filter.js b/jekyll/theme/assets/js/filter.js new file mode 100644 index 0000000..989d63c --- /dev/null +++ b/jekyll/theme/assets/js/filter.js @@ -0,0 +1,42 @@ +/* + * Readerly archive filter. Narrows the archive list to ?s= (words in the title, + * author, series, genre or tags) or ?genre= (one genre or tag). Without JavaScript + * the page lists every review. + */ +(function () { + if (!window.URLSearchParams) return; + var params = new URLSearchParams(window.location.search); + var search = (params.get("s") || "").trim(); + var genre = (params.get("genre") || "").trim(); + if (!search && !genre) return; + + document.addEventListener("DOMContentLoaded", function () { + var list = document.querySelector("[data-filter-list]"); + var note = document.querySelector("[data-search-note]"); + if (!list) return; + + var words = search.toLowerCase().split(/\s+/).filter(Boolean); + var genreKey = "|" + genre.toLowerCase() + "|"; + var shown = 0; + Array.prototype.forEach.call(list.children, function (item) { + var text = item.getAttribute("data-search") || ""; + var match = genre + ? (item.getAttribute("data-genres") || "").indexOf(genreKey) !== -1 + : words.every(function (word) { return text.indexOf(word) !== -1; }); + item.hidden = !match; + if (match) shown += 1; + }); + + if (!note) return; + var term = note.querySelector("[data-search-term]") || document.createElement("strong"); + term.textContent = genre || search; + var label = note.getAttribute(genre ? "data-genre-label" : "data-search-label") || ""; + var count = note.getAttribute(shown === 0 ? "data-none" : shown === 1 ? "data-one" : "data-many") || ""; + note.replaceChildren( + document.createTextNode(label + " \u201c"), + term, + document.createTextNode("\u201d. " + count.replace("%n", shown)) + ); + note.hidden = false; + }); +})(); diff --git a/jekyll/theme/assets/js/theme.js b/jekyll/theme/assets/js/theme.js new file mode 100644 index 0000000..ed66ec6 --- /dev/null +++ b/jekyll/theme/assets/js/theme.js @@ -0,0 +1,88 @@ +/* + * Readerly — optional enhancements. Every page works without this file. + * - Light/dark toggle (remembers the choice; otherwise follows the system) + * - Friendly confirmation for demo forms (newsletter, comments) + * - Search term echo on the archive page + * Loaded in so a saved theme applies before first paint. + */ +(function () { + var root = document.documentElement; + var STORAGE_KEY = "readerly-theme"; + var darkQuery = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null; + + function readStoredTheme() { + try { + return localStorage.getItem(STORAGE_KEY); + } catch (error) { + return null; + } + } + + function storeTheme(value) { + try { + localStorage.setItem(STORAGE_KEY, value); + } catch (error) { + /* Storage blocked: the choice lasts for this page view only. */ + } + } + + function effectiveTheme() { + var explicit = root.getAttribute("data-theme"); + if (explicit === "light" || explicit === "dark") return explicit; + return darkQuery && darkQuery.matches ? "dark" : "light"; + } + + var stored = readStoredTheme(); + if (stored === "light" || stored === "dark") root.setAttribute("data-theme", stored); + + function initThemeToggle() { + var toggle = document.querySelector("[data-theme-toggle]"); + if (!toggle) return; + + function sync() { + toggle.setAttribute("aria-pressed", effectiveTheme() === "dark" ? "true" : "false"); + } + + toggle.hidden = false; + sync(); + toggle.addEventListener("click", function () { + var next = effectiveTheme() === "dark" ? "light" : "dark"; + root.setAttribute("data-theme", next); + storeTheme(next); + sync(); + }); + if (darkQuery && darkQuery.addEventListener) darkQuery.addEventListener("change", sync); + } + + function initDemoForms() { + var forms = document.querySelectorAll("form[data-demo-form]"); + Array.prototype.forEach.call(forms, function (form) { + var status = form.querySelector("[data-form-status]"); + form.addEventListener("submit", function (event) { + event.preventDefault(); + if (!form.checkValidity()) { + form.reportValidity(); + return; + } + form.reset(); + if (status) status.textContent = status.getAttribute("data-message") || ""; + }); + }); + } + + function initSearchNote() { + var note = document.querySelector("[data-search-note]"); + if (!note || !window.URLSearchParams) return; + var term = new URLSearchParams(window.location.search).get("s"); + if (!term) return; + var slot = note.querySelector("[data-search-term]"); + if (slot) slot.textContent = term; + note.hidden = false; + } + + document.addEventListener("DOMContentLoaded", function () { + initThemeToggle(); + initDemoForms(); + initSearchNote(); + }); +})(); diff --git a/jekyll/theme/jekyll-theme-readerly.gemspec b/jekyll/theme/jekyll-theme-readerly.gemspec new file mode 100644 index 0000000..b7f250f --- /dev/null +++ b/jekyll/theme/jekyll-theme-readerly.gemspec @@ -0,0 +1,13 @@ +Gem::Specification.new do |spec| + spec.name = "jekyll-theme-readerly" + spec.version = "1.0.0" + spec.authors = ["List of Books"] + spec.summary = "A Jekyll theme for book blogs, author sites and reading logs." + spec.homepage = "https://github.com/listofbooks-net/jekyll-theme-readerly" + spec.license = "MIT" + spec.metadata = { "plugin_type" => "theme" } + + spec.files = Dir["_layouts/**/*", "_includes/**/*", "assets/**/*", "LICENSE", "README.md"] + + spec.add_runtime_dependency "jekyll", ">= 3.10", "< 5.0" +end diff --git a/tools/build-tokens.mjs b/tools/build-tokens.mjs index 112cf36..14fb22e 100644 --- a/tools/build-tokens.mjs +++ b/tools/build-tokens.mjs @@ -1,9 +1,10 @@ #!/usr/bin/env node -// Generates every platform's token files from design/tokens.json. +// Generates every port's token files, stylesheets, scripts, fonts and images +// from design/: tokens.json, assets/css, assets/js, assets/fonts and assets/img. // Usage: node tools/build-tokens.mjs [--check] // --check writes nothing and exits 1 when any generated file is out of date. -import { readFileSync, writeFileSync, existsSync } from 'node:fs'; +import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync, rmSync } from 'node:fs'; import { dirname, join, relative } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -90,7 +91,7 @@ function buildTokensCss() { /* Colour palette — light ("${light.title.toLowerCase()}") */ ${cssBlock(colorLines('light', true))} - /* Font families (Google Fonts, SIL Open Font License) */ + /* Font families (bundled in assets/fonts, SIL Open Font License) */ ${cssBlock(fonts)} /* Fluid font sizes: min at ${vp.min} wide, max at ${vp.max} wide */ @@ -139,11 +140,51 @@ function readJson(file, fallback) { return existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : fallback; } +function fontFaces(family) { + const { styles, subsets } = tokens.fontFace; + return styles.flatMap((style) => + Object.entries(subsets).map(([subset, unicodeRange]) => ({ + family: family.name, + style, + weight: family.weight, + file: `${family.files}/${family.files}-${subset}-standard-${style}.woff2`, + unicodeRange, + })), + ); +} + +function buildFontsCss() { + const faces = Object.values(tokens.fontFamily).flatMap(fontFaces); + const rules = faces.map( + (f) => `@font-face { + font-family: "${f.family}"; + font-style: ${f.style}; + font-weight: ${f.weight}; + font-display: swap; + src: url("../fonts/${f.file}") format("woff2"); + unicode-range: ${f.unicodeRange}; +}`, + ); + return `/* + * 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. + */ + +${rules.join('\n\n')} +`; +} + +function buildJekyllCss() { + const read = (path) => readFileSync(join(root, path), 'utf8'); + return `/* Readerly for Jekyll. GENERATED by tools/build-tokens.mjs from design/assets/css. Do not edit. */ + +${buildFontsCss()} +${buildTokensCss()} +${read('design/assets/css/style.css')}`; +} + function buildThemeJson(file) { const theme = readJson(file, { $schema: THEME_SCHEMA, version: 3, settings: {}, styles: {} }); - const existingFaces = Object.fromEntries( - (theme.settings?.typography?.fontFamilies ?? []).map((f) => [f.slug, f.fontFace]), - ); setPath(theme, ['settings', 'color', 'palette'], palette('light')); setPath( @@ -153,7 +194,14 @@ function buildThemeJson(file) { name: f.name, slug, fontFamily: f.stack, - ...(existingFaces[slug] ? { fontFace: existingFaces[slug] } : {}), + fontFace: fontFaces(f).map((face) => ({ + fontFamily: face.family, + fontStyle: face.style, + fontWeight: face.weight, + fontDisplay: 'swap', + src: [`file:./assets/fonts/${face.file}`], + unicodeRange: face.unicodeRange, + })), })), ); const existingFluid = theme.settings?.typography?.fluid; @@ -193,10 +241,37 @@ function buildDarkVariation(file) { return `${JSON.stringify(variation, null, '\t')}\n`; } +// Copies every file in src (or only the names listed) to dst. Files in dst +// that are not in the copy set are stale, so dst holds exactly the copies. +function mirror(src, dst, names) { + const walk = (base, dir = '') => + readdirSync(join(root, base, dir), { withFileTypes: true }).flatMap((entry) => + entry.isDirectory() ? walk(base, join(dir, entry.name)) : [join(dir, entry.name)], + ); + const files = names ?? walk(src); + const extra = existsSync(join(root, dst)) ? walk(dst).filter((f) => !files.includes(f)) : []; + return { + copies: files.map((f) => [join(dst, f), () => readFileSync(join(root, src, f))]), + extra: extra.map((f) => join(dst, f)), + }; +} + +const mirrors = [ + mirror('design/assets/fonts', 'wordpress/assets/fonts'), + mirror('design/assets/fonts', 'jekyll/theme/assets/fonts'), + mirror('design/assets/img', 'jekyll/theme/assets/img', ['paper-grain.svg', 'cover-grain.svg']), + mirror('design/assets/covers', 'jekyll/demo/assets/covers'), + mirror('design/assets/img', 'jekyll/demo/assets/img', ['avatar-nora.svg', 'portrait-isobel.svg', 'still-life.svg', 'favicon.svg']), +]; + const outputs = [ ['design/assets/css/tokens.css', () => buildTokensCss()], + ['design/assets/css/fonts.css', () => buildFontsCss()], ['wordpress/theme.json', (file) => buildThemeJson(file)], ['wordpress/styles/lamplight.json', (file) => buildDarkVariation(file)], + ['jekyll/theme/assets/css/readerly.css', () => buildJekyllCss()], + ['jekyll/theme/assets/js/theme.js', () => readFileSync(join(root, 'design/assets/js/theme.js'))], + ...mirrors.flatMap((m) => m.copies), ]; const check = process.argv.includes('--check'); @@ -204,14 +279,21 @@ const stale = []; for (const [path, build] of outputs) { const file = join(root, path); const next = build(file); - const current = existsSync(file) ? readFileSync(file, 'utf8') : null; - if (current === next) continue; - stale.push(relative(root, file)); - if (!check) writeFileSync(file, next); + const current = existsSync(file) ? readFileSync(file) : null; + if (current && current.equals(Buffer.from(next))) continue; + stale.push(path); + if (!check) { + mkdirSync(dirname(file), { recursive: true }); + writeFileSync(file, next); + } +} +for (const path of mirrors.flatMap((m) => m.extra)) { + stale.push(`${path} (not generated, delete it)`); + if (!check) rmSync(join(root, path)); } if (check && stale.length) { console.error(`Out of date (run node tools/build-tokens.mjs):\n ${stale.join('\n ')}`); process.exit(1); } -console.log(stale.length ? `Wrote ${stale.join(', ')}` : 'Tokens are up to date.'); +console.log(stale.length ? `Wrote ${stale.join(', ')}` : 'Generated files are up to date.'); diff --git a/tools/jekyll-dev/.gitignore b/tools/jekyll-dev/.gitignore new file mode 100644 index 0000000..cc8b7de --- /dev/null +++ b/tools/jekyll-dev/.gitignore @@ -0,0 +1,2 @@ +*.log +out/ diff --git a/tools/jekyll-dev/Dockerfile b/tools/jekyll-dev/Dockerfile new file mode 100644 index 0000000..c0e75fc --- /dev/null +++ b/tools/jekyll-dev/Dockerfile @@ -0,0 +1,13 @@ +# One image per engine: docker build --build-arg ENGINE=pages|jekyll4 tools/jekyll-dev +FROM ruby:3.3-bookworm +ARG ENGINE +WORKDIR /work +# A stand-in theme with the real gem's name, version and dependencies, so the +# bundle resolves here. jekyll-dev.sh copies the real theme over it at run time. +RUN mkdir theme && printf '%s\n' \ + 'Gem::Specification.new do |s|' \ + ' s.name = "jekyll-theme-readerly"; s.version = "1.0.0"; s.summary = "stand-in"; s.authors = ["x"]' \ + ' s.add_runtime_dependency "jekyll", ">= 3.10", "< 5.0"' \ + 'end' > theme/jekyll-theme-readerly.gemspec +COPY ${ENGINE}/Gemfile Gemfile +RUN bundle install --jobs 4 --quiet && bundle exec jekyll --version diff --git a/tools/jekyll-dev/build-sites.sh b/tools/jekyll-dev/build-sites.sh new file mode 100755 index 0000000..4c1b6c4 --- /dev/null +++ b/tools/jekyll-dev/build-sites.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Runs inside a readerly-jekyll image. Builds every site in /src/sites with the +# theme in /work/theme and writes /out// plus /out/.log. +# Any output from a quiet build is a warning, so the build fails on it. +set -euo pipefail +engine="$1" +mkdir -p /out +cd /work && bundle install --local --quiet >/dev/null +flags=(--quiet --config _config.yml,/src/check.yml) +[[ "$engine" == pages ]] && flags+=(--safe) +status=0 +for dir in /src/sites/*/; do + name="$(basename "$dir")" + extra=() + [[ "$name" == *-drafts ]] && extra+=(--drafts) + rm -rf "/tmp/$name" && cp -r "$dir" "/tmp/$name" + sed -i '/^remote_theme:/d' "/tmp/$name/_config.yml" + # On GitHub Pages a site with no description gets its repository's description + # from the GitHub API. The checks run offline, so they stand in an empty one. + grep -q '^description:' "/tmp/$name/_config.yml" || echo 'description: ""' >>"/tmp/$name/_config.yml" + # Jekyll loads the bundle's plugins (on Pages: its whole plugin set) only + # when the site has a Gemfile. Bundler reads /work/Gemfile either way. + touch "/tmp/$name/Gemfile" + if ! (cd "/tmp/$name" && BUNDLE_GEMFILE=/work/Gemfile bundle exec jekyll build "${flags[@]}" "${extra[@]}" --destination "/out/$name") >"/out/$name.log" 2>&1; then + echo "$engine/$name: build failed" >&2; status=1 + fi + if [[ -s "/out/$name.log" ]]; then + echo "$engine/$name: build printed output:" >&2; sed 's/^/ /' "/out/$name.log" >&2; status=1 + fi +done +exit "$status" diff --git a/tools/jekyll-dev/check-builds.mjs b/tools/jekyll-dev/check-builds.mjs new file mode 100644 index 0000000..64fc6be --- /dev/null +++ b/tools/jekyll-dev/check-builds.mjs @@ -0,0 +1,119 @@ +// Every check over the output of jekyll-dev.sh build. Exits 1 when any fails. +// node check-builds.mjs +// 1. Each site's HTML is the same on both engines, whitespace aside. +// 2. Every internal link and asset in every page resolves to a built file. +// 3. Attributes parse, no heading is empty, and each fixture's own cases hold (check-markup.mjs). +// 4. The demo matches the design pages' markup (check-parity.mjs). +// 5. Every page of every site passes check-pages.cjs at 1280 and 390 px, in both styles. +import { readdirSync, readFileSync, existsSync, statSync, writeFileSync, mkdirSync } from 'node:fs'; +import { dirname, join, relative, posix } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { spawn } from 'node:child_process'; +import { parse } from 'node-html-parser'; +import { checkParity } from './check-parity.mjs'; +import { checkMarkup } from './check-markup.mjs'; +import { startServer } from './serve.mjs'; + +const here = dirname(fileURLToPath(import.meta.url)); +const repo = join(here, '../..'); +const out = process.argv[2] ?? join(here, 'out'); +const BASE = '/sub'; +const sites = readdirSync(join(out, 'pages'), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name); +const results = []; + +function htmlFiles(dir) { + return readdirSync(dir, { recursive: true }).filter((f) => f.endsWith('.html')).sort(); +} + +function report(name, failures) { + results.push({ name, failures }); + console.log(`${failures.length ? 'FAIL' : 'ok '} ${name}${failures.length ? `\n ${failures.slice(0, 30).join('\n ')}` : ''}`); +} + +// Asynchronous, because the site server runs in this process and must keep answering. +function runNode(args) { + return new Promise((done) => { + const child = spawn(process.execPath, args); + let output = ''; + child.stdout.on('data', (d) => (output += d)); + child.stderr.on('data', (d) => (output += d)); + child.on('close', (status) => done({ status, output })); + }); +} + +const normalise =(html) => html.replace(/>\s+<').replace(/\s+/g, ' ').trim(); + +for (const site of sites) { + const a = join(out, 'pages', site); + const b = join(out, 'jekyll4', site); + const failures = []; + const filesA = htmlFiles(a); + const filesB = existsSync(b) ? htmlFiles(b) : []; + if (filesA.join() !== filesB.join()) failures.push(`different pages: pages has ${filesA.length}, jekyll4 has ${filesB.length}`); + for (const file of filesA.filter((f) => filesB.includes(f))) { + const x = normalise(readFileSync(join(a, file), 'utf8')); + const y = normalise(readFileSync(join(b, file), 'utf8')); + if (x !== y) { + let i = 0; + while (x[i] === y[i]) i += 1; + failures.push(`${file} differs at: pages "${x.slice(i - 40, i + 60)}" / jekyll4 "${y.slice(i - 40, i + 60)}"`); + } + } + report(`${site}: same HTML on Jekyll 3.10 (GitHub Pages) and Jekyll 4.4`, failures); +} + +for (const site of sites) { + const root = join(out, 'pages', site); + const failures = []; + for (const file of htmlFiles(root)) { + const page = `/${file.replace(/index\.html$/, '')}`; + const document = parse(readFileSync(join(root, file), 'utf8')); + for (const element of document.querySelectorAll('[href], [src], form[action]')) { + const raw = element.getAttribute('href') ?? element.getAttribute('src') ?? element.getAttribute('action'); + if (/^([a-z]+:|#|$)/i.test(raw) || raw.startsWith('//')) continue; + const url = new URL(raw, `http://site${BASE}${page}`); + if (!url.pathname.startsWith(`${BASE}/`)) { + failures.push(`${file}: ${raw} is outside the baseurl`); + continue; + } + let target = join(root, decodeURIComponent(url.pathname.slice(BASE.length))); + if (existsSync(target) && statSync(target).isDirectory()) target = join(target, 'index.html'); + if (!existsSync(target)) failures.push(`${file}: ${raw} does not resolve`); + } + } + report(`${site}: every internal link and asset resolves under baseurl ${BASE}`, failures); +} + +for (const site of sites) report(`${site}: attributes parse, no empty headings, and the fixture's own cases`, checkMarkup(join(out, 'pages'), site)); + +if (sites.includes('demo')) report('demo: markup matches the seven design pages', checkParity(join(repo, 'design'), join(out, 'pages', 'demo'))); + +const browserSites = sites.filter((s) => !s.endsWith('-drafts')); +let port = 4100; +for (const site of browserSites) { + const root = join(out, 'pages', site); + const pages = {}; + for (const file of htmlFiles(root).filter((f) => f !== '404.html')) { + const path = `/${file.replace(/index\.html$/, '')}`; + pages[path === '/' ? 'home' : path.replace(/^\/|\/$/g, '').replace(/[^a-z0-9]+/gi, '-')] = path; + } + if (existsSync(join(root, '404.html'))) pages['404'] = '/this-page-does-not-exist/'; + if (site === 'demo') Object.assign(pages, { search: '/reviews/?s=ledger', 'search-empty': '/reviews/?s=zzzzqqq', 'genre-filter': '/reviews/?genre=Fantasy' }); + const mapFile = join(out, `${site}.pages.json`); + writeFileSync(mapFile, JSON.stringify({ pages, notFound: ['404'], colorScheme: { paper: 'light', lamplight: 'dark' } }, null, '\t')); + const shots = join(out, 'shots', site); + mkdirSync(shots, { recursive: true }); + const server = await startServer(root, port); + const failures = []; + for (const label of ['paper', 'lamplight']) { + const run = await runNode([join(repo, 'tools/wp-dev/check-pages.cjs'), `http://127.0.0.1:${port}${BASE}`, shots, label, mapFile]); + if (run.status !== 0) failures.push(...run.output.trim().split('\n')); + } + server.close(); + port += 1; + report(`${site}: browser checks on ${Object.keys(pages).length} pages, 1280 and 390 px, Paper and Lamplight`, failures); +} + +const failed = results.filter((r) => r.failures.length); +console.log(failed.length ? `\n${failed.length} of ${results.length} checks failed.` : `\nAll ${results.length} checks passed.`); +process.exit(failed.length ? 1 : 0); diff --git a/tools/jekyll-dev/check-markup.mjs b/tools/jekyll-dev/check-markup.mjs new file mode 100644 index 0000000..795c59f --- /dev/null +++ b/tools/jekyll-dev/check-markup.mjs @@ -0,0 +1,71 @@ +// Markup checks over the pages build of every site. Each returns failure strings. +// attributes parse: no attribute name is the debris of a broken quoted value +// headings: no empty h1 to h6 +// fixtures: the cases the fixtures exist to prove +import { readFileSync, readdirSync, existsSync } from 'node:fs'; +import { join } from 'node:path'; +import { parse } from 'node-html-parser'; + +const read = (root, file) => parse(readFileSync(join(root, file), 'utf8')); +const htmlFiles = (root) => readdirSync(root, { recursive: true }).filter((f) => f.endsWith('.html')).sort(); + +export function checkMarkup(pagesDir, site) { + const root = join(pagesDir, site); + const failures = []; + for (const file of htmlFiles(root)) { + const document = read(root, file); + for (const element of document.querySelectorAll('*')) { + for (const name of Object.keys(element.attributes)) { + if (!/^[a-z][a-z0-9:_-]*$/i.test(name)) failures.push(`${file}: <${element.tagName.toLowerCase()}> has the attribute "${name}", a quoted value ended early`); + } + } + for (const heading of document.querySelectorAll('h1, h2, h3, h4, h5, h6')) { + if (heading.textContent.trim() === '') failures.push(`${file}: an empty <${heading.tagName.toLowerCase()}>`); + } + } + return [...failures, ...fixtureCases[site]?.(root) ?? []]; +} + +const expect = (failures, ok, message) => ok || failures.push(message); + +const fixtureCases = { + sparse(root) { + const failures = []; + const title = 'The "Quiet" Arithmetic'; + const author = `Ann "Ace" O'Neil `; + const post = read(root, 'quoted-title/index.html'); + const og = post.querySelector('meta[property="og:title"]')?.getAttribute('content') ?? ''; + expect(failures, og.includes(title) && og.includes(author), `og:title lost its quotes: ${og}`); + expect(failures, post.querySelector('link[rel="icon"]')?.getAttribute('href') === '//example.com/favicon.svg', 'a protocol-relative favicon URL was changed'); + const scripts = post.querySelectorAll('script[type="application/ld+json"]'); + expect(failures, scripts.length === 1, `the review has ${scripts.length} JSON-LD blocks, not 1`); + try { + const data = JSON.parse(scripts[0].text); + expect(failures, data.name === title && data.itemReviewed.author.name === author, 'the JSON-LD names changed'); + } catch (error) { + failures.push(`the JSON-LD does not parse: ${error.message}`); + } + const labelled = (file, selector) => read(root, file).querySelectorAll(selector).map((e) => e.getAttribute('aria-label')); + expect(failures, labelled('index.html', '.cover--placeholder').some((l) => l.includes(title) && l.includes(author)), 'no placeholder cover label keeps the title and author'); + expect(failures, labelled('reading-log/index.html', 'progress').some((l) => l.includes(title)), 'no progress label keeps the title'); + const author_page = read(root, 'author/index.html'); + expect(failures, author_page.querySelector('section#about')?.getAttribute('aria-label')?.includes('An Author With "No" Books'), 'the author hero label lost its quotes'); + expect(failures, !author_page.querySelector('#new-release'), 'a book with no title made a new-release section'); + expect(failures, !author_page.querySelector('#events'), 'an event with no title made an events section'); + return failures; + }, + minima(root) { + const failures = []; + expect(failures, read(root, 'index.html').text.includes('This body text belongs to the page'), 'the home layout dropped the page body'); + return failures; + }, + paginated(root) { + const failures = []; + const page = read(root, 'blog/page2/index.html'); + const hrefs = page.querySelectorAll('nav.pagination a').map((a) => a.getAttribute('href')); + expect(failures, hrefs.includes('/sub/blog/'), `the pager does not link to /sub/blog/: ${hrefs.join(' ')}`); + expect(failures, !hrefs.includes('/sub/'), 'the pager links to the site root'); + expect(failures, read(root, 'reviews/index.html').querySelector('h1')?.text.trim() === 'Archive', 'an untitled archive page has no "Archive" heading'); + return failures; + }, +}; diff --git a/tools/jekyll-dev/check-parity.mjs b/tools/jekyll-dev/check-parity.mjs new file mode 100644 index 0000000..e013522 --- /dev/null +++ b/tools/jekyll-dev/check-parity.mjs @@ -0,0 +1,80 @@ +// Markup parity between the design pages and the demo built from the theme. +// Both pages reduce to a tree of tag names, classes, roles and ARIA attribute +// names; runs of siblings with the same tag and classes collapse to their first. +// The trees must be equal once parity-exceptions.json has removed its elements. +// node check-parity.mjs +import { readFileSync } from 'node:fs'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { parse } from 'node-html-parser'; + +export const PAGES = { + 'index.html': '/', + 'review.html': '/the-salt-orchard/', + 'author.html': '/author/', + 'reading-log.html': '/reading-log/', + 'archive.html': '/genres/literary-fiction/', + 'page.html': '/about/', + '404.html': '/404.html', +}; + +const exceptions = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'parity-exceptions.json'), 'utf8')); + +function signature(element) { + const classes = (element.getAttribute('class') ?? '').split(/\s+/).filter(Boolean).sort().join('.'); + const role = element.getAttribute('role'); + const aria = Object.keys(element.attributes).filter((a) => a.startsWith('aria-')).sort(); + return `${element.rawTagName.toLowerCase()}${classes ? `.${classes}` : ''}${role ? `[role=${role}]` : ''}${aria.length ? `[${aria.join(',')}]` : ''}`; +} + +function tree(element) { + const children = []; + let previousKey = null; + for (const child of element.childNodes) { + if (child.nodeType !== 1) continue; + const key = `${child.rawTagName}|${child.getAttribute('class') ?? ''}`; + if (key === previousKey) continue; + previousKey = key; + children.push(tree(child)); + } + return { sig: signature(element), children }; +} + +function body(html, page, side) { + const root = parse(html, { comment: false }); + const bodyElement = root.querySelector('body'); + const drop = ['script', '.demo-bar', ...exceptions.filter((e) => e.page === page && (e.side === side || e.side === 'both')).map((e) => e.selector)]; + for (const selector of drop) for (const element of bodyElement.querySelectorAll(selector)) element.remove(); + return tree(bodyElement); +} + +function compare(a, b, path, problems) { + const here = `${path} > ${a.sig}`; + if (a.sig !== b.sig) { + problems.push(`${path}: design ${a.sig}, demo ${b.sig}`); + return; + } + const length = Math.max(a.children.length, b.children.length); + for (let i = 0; i < length; i += 1) { + if (!a.children[i]) problems.push(`${here}: demo has extra ${b.children[i].sig}`); + else if (!b.children[i]) problems.push(`${here}: design has ${a.children[i].sig}, demo has nothing`); + else compare(a.children[i], b.children[i], here, problems); + } +} + +export function checkParity(designDir, demoDir) { + const failures = []; + for (const [page, url] of Object.entries(PAGES)) { + const file = url.endsWith('/') ? join(demoDir, url, 'index.html') : join(demoDir, url); + const problems = []; + compare(body(readFileSync(join(designDir, page), 'utf8'), page, 'design'), body(readFileSync(file, 'utf8'), page, 'demo'), '', problems); + failures.push(...problems.slice(0, 8).map((p) => `${page}${p}`)); + } + return failures; +} + +if (import.meta.url === `file://${process.argv[1]}`) { + const failures = checkParity(process.argv[2], process.argv[3]); + console.log(failures.length ? failures.join('\n') : `Markup parity holds for all ${Object.keys(PAGES).length} design pages.`); + process.exit(failures.length ? 1 : 0); +} diff --git a/tools/jekyll-dev/check.yml b/tools/jekyll-dev/check.yml new file mode 100644 index 0000000..7455c7b --- /dev/null +++ b/tools/jekyll-dev/check.yml @@ -0,0 +1,11 @@ +# Overlay for every check build. build-sites.sh deletes the site's remote_theme +# line, and this file loads the same theme from the local gem instead. The baseurl +# makes every link go through relative_url, and the fixed time makes builds +# reproducible. +theme: jekyll-theme-readerly +url: http://localhost:4000 +baseurl: /sub +time: 2026-11-12T12:00:00Z +liquid: + error_mode: strict + strict_filters: true diff --git a/tools/jekyll-dev/jekyll-dev.sh b/tools/jekyll-dev/jekyll-dev.sh new file mode 100755 index 0000000..06af60d --- /dev/null +++ b/tools/jekyll-dev/jekyll-dev.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +# Local Jekyll builds and checks for the Readerly Jekyll theme. Needs Docker and Node. +# +# tools/jekyll-dev/jekyll-dev.sh images build the two engine images: pages (GitHub Pages 232, Jekyll 3.10) and jekyll4 (Jekyll 4.4) +# tools/jekyll-dev/jekyll-dev.sh build build the demo, the starter and the fixtures on both engines into tools/jekyll-dev/out/ +# tools/jekyll-dev/jekyll-dev.sh check build, then run every check over the output (see README.md) +# tools/jekyll-dev/jekyll-dev.sh serve [site] [port] serve a built site (default demo) at http://localhost:/sub/ +# +# Files are copied into containers rather than bind-mounted, so the same commands +# work on a workstation and inside a CI job that talks to the host's Docker. +set -euo pipefail + +here="$(cd "$(dirname "$0")" && pwd)" +repo="$(cd "$here/../.." && pwd)" +out="$here/out" +engines=(pages jekyll4) + +images() { + for engine in "${engines[@]}"; do + docker build -q --build-arg ENGINE="$engine" -t "readerly-jekyll:$engine" "$here" >/dev/null + done +} + +stage_sites() { + local stage="$1" + mkdir -p "$stage/sites" + cp -r "$repo/jekyll/demo" "$stage/sites/demo" + cp -r "$repo/jekyll/starter" "$stage/sites/starter" + cp -r "$repo/jekyll/starter" "$stage/sites/starter-drafts" + for fixture in "$repo"/jekyll/fixtures/*/; do + cp -r "$fixture" "$stage/sites/$(basename "$fixture")" + done + cp "$here/check.yml" "$here/build-sites.sh" "$stage/" +} + +build_engine() { + local engine="$1" stage="$2" cid status=0 + cid="$(docker create "readerly-jekyll:$engine" bash /src/build-sites.sh "$engine")" + docker cp "$stage/." "$cid:/src" + docker cp "$repo/jekyll/theme/." "$cid:/work/theme" + docker start -a "$cid" || status=$? + rm -rf "${out:?}/$engine" && mkdir -p "$out/$engine" + docker cp "$cid:/out/." "$out/$engine" 2>/dev/null || true + docker rm -f "$cid" >/dev/null + return "$status" +} + +build() { + local stage status=0 + stage="$(mktemp -d)" + trap 'rm -rf "$stage"' RETURN + stage_sites "$stage" + for engine in "${engines[@]}"; do + build_engine "$engine" "$stage" || status=1 + done + [[ "$status" == 0 ]] && echo "Built $(ls "$stage/sites" | tr '\n' ' ')on ${engines[*]} into $out" + return "$status" +} + +case "${1:-}" in + images) images ;; + build) build ;; + check) + build + node "$here/check-builds.mjs" "$out" + ;; + serve) + node "$here/serve.mjs" "$out/pages/${2:-demo}" "${3:-4000}" + ;; + *) + sed -n '2,10p' "$0" + exit 1 + ;; +esac diff --git a/tools/jekyll-dev/jekyll4/Gemfile b/tools/jekyll-dev/jekyll4/Gemfile new file mode 100644 index 0000000..da54f98 --- /dev/null +++ b/tools/jekyll-dev/jekyll4/Gemfile @@ -0,0 +1,10 @@ +source "https://rubygems.org" + +gem "jekyll", "= 4.4.1" +gem "jekyll-theme-readerly", path: "/work/theme" + +group :jekyll_plugins do + gem "jekyll-feed", "= 0.17.0" + gem "jekyll-paginate", "= 1.1.0" + gem "jekyll-remote-theme", "= 0.4.3" +end diff --git a/tools/jekyll-dev/pages/Gemfile b/tools/jekyll-dev/pages/Gemfile new file mode 100644 index 0000000..1e97203 --- /dev/null +++ b/tools/jekyll-dev/pages/Gemfile @@ -0,0 +1,7 @@ +# The gem set GitHub Pages builds with (https://pages.github.com/versions.json). +source "https://rubygems.org" + +gem "github-pages", "= 232", group: :jekyll_plugins +gem "jekyll-theme-readerly", path: "/work/theme" +# Silences the Faraday warning jekyll-github-metadata prints on every build. +gem "faraday-retry" diff --git a/tools/jekyll-dev/parity-exceptions.json b/tools/jekyll-dev/parity-exceptions.json new file mode 100644 index 0000000..ddecb72 --- /dev/null +++ b/tools/jekyll-dev/parity-exceptions.json @@ -0,0 +1,38 @@ +[ + { + "page": "index.html", + "side": "demo", + "selector": ".pagination", + "reason": "The demo has ten reviews and paginate: 9, so the home page links to page 2. The design shows a site with one page of reviews." + }, + { + "page": "index.html", + "side": "design", + "selector": ".form-status", + "reason": "The design's newsletter form confirms a fake submission in place. The theme's form posts to the site's newsletter provider, which shows its own confirmation." + }, + { + "page": "author.html", + "side": "design", + "selector": ".form-status", + "reason": "The design's newsletter form confirms a fake submission in place. The theme's form posts to the site's newsletter provider, which shows its own confirmation." + }, + { + "page": "author.html", + "side": "both", + "selector": ".site-tools", + "reason": "The design's author page is a separate author site with no reviews to search. The demo's author page sits inside the Marginalia blog, which has an archive and so a search form." + }, + { + "page": "review.html", + "side": "design", + "selector": ".comments", + "reason": "The theme ships no comment system, because every hosted one makes third-party requests. _includes/comments.html is the empty hook where a site owner adds one." + }, + { + "page": "archive.html", + "side": "design", + "selector": ".pagination", + "reason": "GitHub Pages paginates only the home page (jekyll-paginate v1), so an archive page lists every review on one page." + } +] diff --git a/tools/jekyll-dev/serve.mjs b/tools/jekyll-dev/serve.mjs new file mode 100644 index 0000000..b96b86f --- /dev/null +++ b/tools/jekyll-dev/serve.mjs @@ -0,0 +1,53 @@ +// Serves a built Jekyll site under /sub/, the baseurl the check builds use, the +// way GitHub Pages does: directory URLs get index.html and misses get 404.html. +// node serve.mjs [port] +import { createServer } from 'node:http'; +import { readFile, stat } from 'node:fs/promises'; +import { extname, join, normalize } from 'node:path'; + +const BASE = '/sub'; +const TYPES = { '.html': 'text/html; charset=utf-8', '.css': 'text/css', '.js': 'text/javascript', '.svg': 'image/svg+xml', '.woff2': 'font/woff2', '.xml': 'application/xml', '.json': 'application/json', '.txt': 'text/plain', '.png': 'image/png', '.jpg': 'image/jpeg' }; + +async function resolve(root, path) { + const file = join(root, normalize(path)); + try { + const info = await stat(file); + if (info.isDirectory()) return path.endsWith('/') ? resolve(root, `${path}index.html`) : { redirect: `${BASE}${path}/` }; + return { file }; + } catch { + return null; + } +} + +export function startServer(root, listenPort) { + return new Promise((done) => { + const server = createServer(async (request, response) => { + const url = new URL(request.url, 'http://localhost'); + const path = decodeURIComponent(url.pathname); + let found = path === BASE || path.startsWith(`${BASE}/`) ? await resolve(root, path.slice(BASE.length) || '/') : null; + if (found?.redirect) { + response.writeHead(301, { location: found.redirect + url.search }); + return response.end(); + } + let status = 200; + if (!found) { + status = 404; + found = { file: join(root, '404.html') }; + } + try { + const body = await readFile(found.file); + response.writeHead(status, { 'content-type': TYPES[extname(found.file)] ?? 'application/octet-stream' }); + response.end(body); + } catch { + response.writeHead(404).end(); + } + }); + server.listen(Number(listenPort), '127.0.0.1', () => done(server)); + }); +} + +if (import.meta.url === `file://${process.argv[1]}`) { + const [root, port = '4000'] = process.argv.slice(2); + await startServer(root, port); + console.log(`Serving ${root} at http://localhost:${port}${BASE}/`); +} diff --git a/tools/jekyll-dev/side-by-side.mjs b/tools/jekyll-dev/side-by-side.mjs new file mode 100644 index 0000000..1fb3fd7 --- /dev/null +++ b/tools/jekyll-dev/side-by-side.mjs @@ -0,0 +1,70 @@ +// Screenshots each design page next to the demo page built from it, at 1280 and +// 390 px in Paper and Lamplight, and writes out/side-by-side/index.html to compare +// them by eye. Needs a demo build (jekyll-dev.sh build). +// node side-by-side.mjs [out dir] +import { createServer } from 'node:http'; +import { readFile } from 'node:fs/promises'; +import { mkdirSync, writeFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; +import { dirname, extname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { PAGES } from './check-parity.mjs'; +import { startServer } from './serve.mjs'; + +const require = createRequire(import.meta.url); +const here = dirname(fileURLToPath(import.meta.url)); +const out = process.argv[2] ?? join(here, 'out'); +const shots = join(out, 'side-by-side'); +mkdirSync(shots, { recursive: true }); + +const design = createServer(async (request, response) => { + const path = decodeURIComponent(new URL(request.url, 'http://x').pathname); + try { + const body = await readFile(join(here, '../../design', path)); + const type = { '.html': 'text/html', '.css': 'text/css', '.js': 'text/javascript', '.svg': 'image/svg+xml', '.woff2': 'font/woff2' }[extname(path)]; + response.writeHead(200, { 'content-type': type ?? 'application/octet-stream' }).end(body); + } catch { + response.writeHead(404).end(); + } +}).listen(4290, '127.0.0.1'); +const demo = await startServer(join(out, 'pages', 'demo'), 4291); + +let chromium; +for (const name of [process.env.PLAYWRIGHT_MODULE, 'playwright', 'playwright-core'].filter(Boolean)) { + try { + ({ chromium } = require(name)); + break; + } catch {} +} +const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH || undefined }); +const rows = []; +for (const [scheme, label] of [['light', 'paper'], ['dark', 'lamplight']]) { + for (const width of [1280, 390]) { + const context = await browser.newContext({ viewport: { width, height: 900 }, deviceScaleFactor: 1, colorScheme: scheme }); + const page = await context.newPage(); + for (const [file, url] of Object.entries(PAGES)) { + const name = `${file.replace('.html', '')}-${width}-${label}`; + for (const [side, address] of [['design', `http://127.0.0.1:4290/${file}`], ['demo', `http://127.0.0.1:4291/sub${url}`]]) { + await page.goto(address, { waitUntil: 'networkidle' }); + await page.evaluate(async () => { + document.querySelector('.demo-bar')?.remove(); + document.querySelectorAll('img').forEach((i) => (i.loading = 'eager')); + await Promise.all([...document.images].map((i) => (i.complete ? 0 : new Promise((r) => (i.onload = i.onerror = r))))); + await document.fonts.ready; + }); + await page.screenshot({ path: join(shots, `${name}-${side}.png`), fullPage: true }); + } + rows.push(name); + } + await context.close(); + } +} +await browser.close(); +design.close(); +demo.close(); +writeFileSync( + join(shots, 'index.html'), + `Design vs demo +${rows.map((n) => `

${n}

design
demo
`).join('\n')}`, +); +console.log(`Wrote ${rows.length} pairs to ${shots}/index.html`); diff --git a/tools/package-lock.json b/tools/package-lock.json index 000f831..4e5433c 100644 --- a/tools/package-lock.json +++ b/tools/package-lock.json @@ -6,7 +6,9 @@ "": { "name": "readerly-tools", "devDependencies": { - "ajv": "8.17.1" + "ajv": "8.17.1", + "node-html-parser": "9.0.7", + "playwright-core": "1.61.0" } }, "node_modules/ajv": { @@ -26,6 +28,128 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, + "node_modules/css-select": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", + "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", + "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/dom-serializer/node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -57,6 +181,43 @@ "dev": true, "license": "MIT" }, + "node_modules/node-html-parser": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-9.0.7.tgz", + "integrity": "sha512-0Io6nKYNN2e+QSoJFxU991Z8kX4H2Ogy3l14Ow0XxR2Wonk9l5qBonx1dYO97UyVfYJ1U9H0WHZOIZW6q5KPrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-select": "^5.1.0", + "entities": "^8.0.0" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/playwright-core": { + "version": "1.61.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.0.tgz", + "integrity": "sha512-caX7TrY3Ml6egyDX0WUcTHDxodl/b51y5wJOdCEA36QviK/s2g081hvmGs8eaE3DWb6NYZQ6BjO/QkNRPenoPA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", diff --git a/tools/package.json b/tools/package.json index a3070f2..d67853a 100644 --- a/tools/package.json +++ b/tools/package.json @@ -4,6 +4,8 @@ "type": "module", "description": "Development tools for the Readerly theme. Not part of the theme zip.", "devDependencies": { - "ajv": "8.17.1" + "ajv": "8.17.1", + "node-html-parser": "9.0.7", + "playwright-core": "1.61.0" } } diff --git a/tools/publish-jekyll.sh b/tools/publish-jekyll.sh new file mode 100644 index 0000000..199b2ed --- /dev/null +++ b/tools/publish-jekyll.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# Publishes a Jekyll theme release to the two public mirror repositories. +# +# tools/publish-jekyll.sh for example: tools/publish-jekyll.sh 1.0.0 +# +# 1. Checks that the tree is clean, on main, equal to origin/main after a fetch, and +# that the gemspec has . +# 2. Runs every Jekyll check (tools/jekyll-dev/jekyll-dev.sh check). +# 3. Splits jekyll/theme and jekyll/starter out of this repository's history and +# pushes only the theme's tag v. +# 4. Builds the starter on the GitHub Pages image with its remote_theme line pinned +# to @v, which downloads that tag from GitHub. +# 5. Only when that build passes, moves the branch v that remote_theme users +# follow and the theme's main, and pushes the starter's main. +# +# Pushing is public and cannot be taken back, so only an operator runs this, by hand. +# Set THEME_REMOTE and STARTER_REMOTE to push somewhere else, for example a fork. +set -euo pipefail + +version="${1:?usage: tools/publish-jekyll.sh }" +[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "version must look like 1.0.0" >&2; exit 1; } +major="${version%%.*}" +repo="$(cd "$(dirname "$0")/.." && pwd)" +theme_remote="${THEME_REMOTE:-git@github.com:listofbooks-net/jekyll-theme-readerly.git}" +starter_remote="${STARTER_REMOTE:-git@github.com:listofbooks-net/jekyll-theme-readerly-starter.git}" +cd "$repo" + +[[ -z "$(git status --porcelain)" ]] || { echo "the working tree is not clean" >&2; exit 1; } +[[ "$(git branch --show-current)" == main ]] || { echo "publish from main" >&2; exit 1; } +git fetch --quiet origin main +[[ "$(git rev-parse HEAD)" == "$(git rev-parse origin/main)" ]] || { echo "HEAD is not origin/main; pull or push first" >&2; exit 1; } +grep -q "spec.version = \"$version\"" jekyll/theme/jekyll-theme-readerly.gemspec || + { echo "jekyll/theme/jekyll-theme-readerly.gemspec does not have version $version" >&2; exit 1; } +grep -q "remote_theme: listofbooks-net/jekyll-theme-readerly@v$major\$" jekyll/starter/_config.yml || + { echo "jekyll/starter/_config.yml does not use @v$major" >&2; exit 1; } + +node tools/build-tokens.mjs --check +tools/jekyll-dev/jekyll-dev.sh check + +theme_sha="$(git subtree split --prefix=jekyll/theme)" +starter_sha="$(git subtree split --prefix=jekyll/starter)" +git push "$theme_remote" "$theme_sha:refs/tags/v$version" + +stage="$(mktemp -d)" +trap 'rm -rf "$stage"' EXIT +cp -r jekyll/starter "$stage/starter" +sed -i "s|^remote_theme: .*|remote_theme: listofbooks-net/jekyll-theme-readerly@v$version|" "$stage/starter/_config.yml" +grep -q "^remote_theme: listofbooks-net/jekyll-theme-readerly@v$version\$" "$stage/starter/_config.yml" || + { echo "could not pin the starter to @v$version" >&2; exit 1; } +cid="$(docker create -w /src/starter readerly-jekyll:pages bash -c 'BUNDLE_GEMFILE=/work/Gemfile bundle exec jekyll build --safe --quiet && test -f _site/assets/css/readerly.css && grep -q "Theme by List of Books" _site/index.html')" +docker cp "$stage/." "$cid:/src" +if docker start -a "$cid"; then + echo "The starter builds on GitHub Pages against @v$version." +else + echo "The starter did not build against @v$version. The tag v$version is pushed; delete it (git push $theme_remote :refs/tags/v$version) before you retry." >&2 + docker rm -f "$cid" >/dev/null + exit 1 +fi +docker rm -f "$cid" >/dev/null + +git push "$theme_remote" "$theme_sha:refs/heads/main" "$theme_sha:refs/heads/v$major" +git push "$starter_remote" "$starter_sha:refs/heads/main" +echo "Published v$version. Mark the starter repository as a template in its GitHub settings if it is new." diff --git a/tools/wp-dev/check-pages.cjs b/tools/wp-dev/check-pages.cjs index 4bbb36c..40f1bd0 100644 --- a/tools/wp-dev/check-pages.cjs +++ b/tools/wp-dev/check-pages.cjs @@ -1,16 +1,33 @@ // Screenshots every demo page at desktop and mobile width and checks what a // reviewer would otherwise check by eye. Exits 1 when any check fails. // -// node tools/wp-dev/check-pages.cjs [label] +// node tools/wp-dev/check-pages.cjs [label] [page map] +// +// The page map is a JSON file; the default, pages.json beside this file, lists +// the WordPress demo. Its keys: +// pages { name: path } to check, relative to the site url +// notFound names that must answer HTTP 404 +// mobileMenu { open, panel, close } selectors of a menu toggle to exercise at 390 px +// colorScheme {