diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fd3fd4..a03f341 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,3 +112,42 @@ jobs: trap 'docker rm -f "$cid" >/dev/null' EXIT docker cp . "$cid:/repo" docker start -a "$cid" + + ghost: + name: Ghost theme (GScan, demo, markup and browser checks) + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + GHOST_NETWORK: readerly-ghost-ci + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: node tools/build-tokens.mjs --check + - run: node tools/ghost-locales.mjs --check + # GScan runs inside the ghost:6 image on the zip that would ship. Any error or + # warning fails. + - name: Build the theme zip and run GScan on it + run: | + set -euo pipefail + zip="$(tools/build-ghost-zip.sh)" + tools/ghost-dev/ghost-dev.sh gscan "$zip" -z + rm -rf "$RUNNER_TEMP/ghost-theme" && mkdir -p "$RUNNER_TEMP/ghost-theme" + unzip -q "$zip" -d "$RUNNER_TEMP/ghost-theme" + # A job container cannot reach ports published on the host, so Ghost and the + # checks share a Docker network and Ghost answers there as http://ghost:2368. + - name: Start Ghost with the zipped theme and load the demo + run: | + set -euo pipefail + docker network create "$GHOST_NETWORK" + THEME_DIR="$RUNNER_TEMP/ghost-theme/readerly" tools/ghost-dev/ghost-dev.sh up + - name: Markup parity, browser checks and side-by-side screenshots + run: tools/ghost-dev/ghost-dev.sh check + - name: Stop Ghost + if: always() + run: | + tools/ghost-dev/ghost-dev.sh clean + docker network rm "$GHOST_NETWORK" >/dev/null 2>&1 || true diff --git a/.gitignore b/.gitignore index b947077..d356ac1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules/ dist/ +tools/ghost-dev/.state +tools/ghost-dev/out/ diff --git a/README.md b/README.md index 44cff31..282b40f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Readerly -Readerly is a free theme for people who love books, for WordPress, Jekyll and Hugo. 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. +Readerly is a free theme for people who love books, for WordPress, Jekyll, Hugo and Ghost. 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. -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, and the Hugo theme on Hugo 0.146.0 or later, both under the MIT License. +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, the Hugo theme on Hugo 0.146.0 or later, and the Ghost theme on Ghost 6, all three under the MIT License. ## Layout @@ -16,7 +16,8 @@ The WordPress theme requires WordPress 6.9 and PHP 7.4, under GPLv2 or later. Th | `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). | | `hugo/theme/` | The Hugo theme, published as `listofbooks-net/hugo-theme-readerly`, with its demo site, Marginalia, in `hugo/theme/exampleSite/`. | | `hugo/fixtures/` | Sites that only the checks build: `bare` (a title and nothing else), `quickstart` (what `hugo new site` and `hugo new content` make), `sparse` (one review per missing field), `paginated` (a custom pager path) and `no-credit` (the credit partial emptied). | -| `tools/` | The generator, the checks that CI runs, the zip builder, a local WordPress and the Jekyll and Hugo build images. None of it ships. | +| `ghost/` | The Ghost theme. Its contents are what ships; `ghost/README.md` is the theme's documentation. | +| `tools/` | The generator, the checks that CI runs, the zip builder, a local WordPress and the Jekyll and Hugo build images and a local Ghost. None of it ships. | ## Generated files @@ -28,12 +29,15 @@ The WordPress theme requires WordPress 6.9 and PHP 7.4, under GPLv2 or later. Th - `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/` - `hugo/theme/assets/readerly/css/readerly.css` (the same CSS as the Jekyll theme's) and `hugo/theme/assets/readerly/js/theme.js`, the theme's fonts and images in `hugo/theme/static/readerly/`, and the demo's covers and images in `hugo/theme/exampleSite/static/assets/` +- `ghost/assets/css/readerly.css` (fonts, tokens and `design/assets/css/style.css`), `ghost/assets/js/theme.js`, and the Ghost theme's fonts and images ```sh node tools/build-tokens.mjs # regenerate node tools/build-tokens.mjs --check # exit 1 if a generated file is out of date ``` +`node tools/ghost-locales.mjs [--check]` does the same for `ghost/locales/en.json`, from the strings in the Ghost templates. + 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 @@ -59,7 +63,7 @@ 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 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. +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, Hugo and Ghost check in the sections below. ## Build and check the Jekyll theme @@ -123,6 +127,53 @@ To compare the design pages with the demo by eye, run `node tools/hugo-dev/side- `tools/publish-hugo.sh ` pushes a release to the public repository: the tag first, then `main`. Hugo Modules resolve the semantic version tag, so there is no branch to move. Only an operator runs it; see the header of the script. +## Run Ghost locally + +You need Docker and Node 20 or later. The script starts Ghost 6 (the `ghost:6` image, SQLite) with `ghost/` mounted read-only as the theme `readerly`, creates the admin, activates the theme and loads the Marginalia demo. Ghost listens on the first free port from 2380 (set `PORT` to fix it) and the script remembers the port in `tools/ghost-dev/.state`. The admin login is `admin@readerly.test` with the password in `tools/ghost-dev/seed.mjs`. + +```sh +tools/ghost-dev/ghost-dev.sh up # start, set up, activate the theme, seed +tools/ghost-dev/ghost-dev.sh seed # reload the demo content +tools/ghost-dev/ghost-dev.sh gscan # GScan for Ghost 6 on ghost/; or: gscan dist/readerly-ghost-1.0.0.zip -z +tools/ghost-dev/ghost-dev.sh check # markup parity, browser checks, side-by-side screenshots +tools/ghost-dev/ghost-dev.sh export site/ https://readerly-ghost-demo.pages.dev # static copy, verified in a browser +tools/ghost-dev/ghost-dev.sh url # print the site URL +tools/ghost-dev/ghost-dev.sh down # stop, keep the data +tools/ghost-dev/ghost-dev.sh clean # remove the container and its data +``` + +`gscan` runs the GScan that ships in the `ghost:6` image and exits with 1 on any error or warning. Recommendations do not fail it. + +Editing a template needs `down` and `up` again, because Ghost reads templates at start. To mount another theme folder, set `THEME_DIR`. + +### Demo content + +`seed.mjs` loads the demo through the Admin API. It first deletes every post, page and tag, so a rerun gives the same slugs and the same HTML. It reuses the images it uploaded before, because Ghost cannot delete an upload and would rename a repeat to `name-2.svg`. The content comes from `jekyll/demo` and `design/`: + +- Ten reviews are posts. The newest, The Salt Orchard, is featured. A review's `excerpt` is the post's `custom_excerpt`; the Jekyll `lead` is not loaded, because Ghost has one summary field and the theme prints it under the title and on the cards. +- Facts about a book are internal tags in the order genre, other public tags, `#by:`, `#series:`, `#rating:`, `#pages:`, `#published:`, then the status (`#read`, `#reading`, `#want-to-read`, `#did-not-finish`). The tag table is in the theme README. +- Books on the reading log with no review are pages with the same fact tags, plus `#on-page:` for a book in progress. Isobel Thorne's four novels are pages tagged `#book` and `#buy:`. +- Design markup that Ghost's editor would flatten (the verdict, the pull quote, the praise and events lists, the where-to-buy block) goes in as HTML cards. +- The site settings, navigation, accent colour, Nora Vale's profile and the theme's custom settings are set too. The seed prints any theme setting the theme does not define. + +### Checks against the running site + +`check` runs three things: + +1. Markup parity. Each of the seven design pages and its Ghost page reduce to a tree of tag names, classes, roles and ARIA attributes, and the trees must match. `tools/ghost-dev/parity-exceptions.json` lists the elements removed from either side first, each with a reason. The algorithm is `tools/jekyll-dev/check-parity.mjs`. +2. `tools/wp-dev/check-pages.cjs` on the pages in `tools/ghost-dev/pages.json`, at 1280 px and 390 px, in Paper and Lamplight. Requests to `cdn.jsdelivr.net/ghost/`, where Ghost loads Portal and its search from, are allowed; any other third-party request fails. +3. `tools/ghost-dev/side-by-side.mjs` screenshots each design page next to the Ghost page. Open `tools/ghost-dev/out/side-by-side/index.html`. + +### Static copy for the demo site + +`export` crawls the sitemaps, the home page, the feed, the 404 page and everything they reference into a folder you can host on Cloudflare Pages. It rewrites the Ghost address to the public one. It removes Portal, the comments and the member-attribution scripts, and the comments section. It turns each `form[data-members-form]` into `data-demo-form`, which the theme script confirms in place. Search keeps working: sodo-search reads three files, `/ghost/api/content/search-index/posts/`, `.../authors/` and `.../tags/`, and the export saves them. It writes `_headers`, which allows framing by `ghost.org` for the Marketplace preview, and `_redirects` when Ghost redirected something while crawling. The export then serves the copy, loads every page in a browser and fails on a request to the Ghost address, a failed request, or a search for "Salt" that finds nothing. + +`tools/publish-ghost-demo.sh` runs all of that and deploys the copy with `wrangler pages deploy`. It changes a public site, so only an operator runs it, by hand. + +### In CI + +The `ghost` job builds the zip (`tools/build-ghost-zip.sh`, which writes `dist/readerly-ghost-.zip`), runs GScan on it, starts Ghost with the unzipped theme, seeds it and runs `check`. A CI job cannot reach ports published on the host, so it sets `GHOST_NETWORK`: Ghost joins that Docker network as `ghost`, and the seed and the checks run in a Playwright container on the same network. + ## Build the zip ```sh @@ -137,4 +188,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/. 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`, and in Hugo an empty `layouts/_partials/credit.html`. +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`, and in Hugo an empty `layouts/_partials/credit.html`. The Ghost theme prints it next to "Published with Ghost" from `ghost/partials/site/credit.hbs`, which a site owner edits in the theme files. diff --git a/ghost/LICENSE b/ghost/LICENSE new file mode 100644 index 0000000..79e7e12 --- /dev/null +++ b/ghost/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/ghost/README.md b/ghost/README.md new file mode 100644 index 0000000..490ae48 --- /dev/null +++ b/ghost/README.md @@ -0,0 +1,170 @@ +# Readerly for Ghost + +Readerly is a free Ghost theme for people who love books. It is built for a book blog first, and it also gives you a reading log and an author website. It comes in two styles, Paper (light) and Lamplight (dark), and bundles its fonts, Fraunces and Literata, so it loads no fonts from other servers. + +- Demo: Marginalia, a book blog by the fictional reviewer Nora Vale. +- Requires Ghost 6.0 or later. +- License: MIT. The fonts are under the SIL Open Font License (`assets/fonts/*/OFL.txt`). + +## Install + +1. Download `readerly-ghost-.zip`. +2. In Ghost Admin, go to **Settings > Design & branding > Change theme > Upload theme** and select the zip file. +3. Click **Activate**. + +The theme works with any existing Ghost content. Every section that needs book data shows nothing until you add that data. + +## Theme settings + +Go to **Settings > Design & branding > Customize**. + +| Setting | Group | What it does | +| --- | --- | --- | +| Color scheme | Site-wide | Paper, Lamplight, or Auto (follows the reader's system setting). | +| Style toggle | Site-wide | Shows a button in the header that switches between Paper and Lamplight. | +| Footer about | Site-wide | One or two sentences under the site title in the footer. | +| Secondary navigation title | Site-wide | The heading of the secondary navigation in the footer. The default is "Genres". | +| Copyright note | Site-wide | Text after the copyright line. | +| Intro eyebrow, heading, lead | Homepage | The introduction at the top of the home page. Put words in `*asterisks*` to set them in italics. An empty heading hides the introduction. | +| Intro button text | Homepage | A button that links to your newest post. | +| Secondary button text and URL | Homepage | A second button, for example to your reading log. | +| Show currently reading | Homepage | Shows books tagged `#reading`. | +| Show genres | Homepage | Shows your tags with the number of posts in each. | +| Newsletter eyebrow, heading, note | Homepage | The signup section. It shows only when your site lets visitors sign up. | +| Show related reviews | Post | Shows up to three posts with the same primary tag. | +| Show reviewer bio | Post | Shows the author's bio card when the author has a bio. | + +Ghost's own settings also apply: the site title, description (shown as the tagline), logo, icon, accent color, navigation, secondary navigation, and the heading and body fonts under **Typography**. + +## Write a book review + +A review is an ordinary Ghost post. + +- **Cover**: the post's feature image. Add alt text, for example "Cover of The Salt Orchard by Mira Hollis". +- **Summary**: the post's excerpt. It shows under the title and on cards. +- **Genre**: the first public tag. It is the post's primary tag. Readerly treats every public tag as a genre: tags show as chips on the review, in "Browse by genre" on the home page and as related genres on tag pages. Keep series, ratings and other facts in internal tags (below), so the genre lists stay genres. +- **Book facts**: internal tags, which start with `#`. Readers never see the tags themselves; the theme reads them. + +| Internal tag | Example | Shows | +| --- | --- | --- | +| `#by:` | `#by:Mira Hollis` | "by Mira Hollis" on cards and in the book panel. A post with this tag is a book review. | +| `#rating:<0 to 5>` | `#rating:4.5` | Stars on cards, in the book panel, and in the Review structured data. Use whole or half numbers, such as `4` or `4.5`; the theme ignores any other value. | +| `#series:` | `#series:The Tidewater Books · Book 2 of 3` | A Series row in the book panel. | +| `#pages:` | `#pages:384` | A Pages row, the reading progress bar, and the pages count on the reading log. | +| `#published:` | `#published:2026 · Harrow & Lane` | A Published row in the book panel. | +| `#on-page:` | `#on-page:142` | With `#reading` and `#pages`, the reading progress bar. | +| `#reading`, `#read`, `#want-to-read`, `#did-not-finish` | `#read` | A status badge, and the shelf on your reading log. | + +Ghost's tag field treats a comma as the end of a tag, so do not use commas inside a tag. Use ` · ` instead. + +A post with `#by:` shows a book panel with the cover and the facts. A post without it shows its feature image as a normal header image. A book without a cover image gets a typeset placeholder cover. + +Mark a post as featured to label it "Featured" on cards and on the home page. + +### Verdict, pull quote and other review blocks + +Readerly styles Ghost's cards: images (normal, wide and full width), galleries, bookmarks, embeds, callouts, toggles, buttons, products, headers, files, audio, video and the alternative blockquote style. For the design's verdict box and pull quote, add an **HTML** card with this markup. Save it as a snippet to reuse it. + +```html +
+
+

My verdict

+
+
+

Patient, precise and quietly devastating.

+
+

What worked

  • The orchard as a living clock
+

Less so

  • A too-tidy ending
+
+
+``` + +```html +
+

“Grief is a ledger you keep in pencil.”

+
The Salt Orchard, chapter nine
+
+``` + +## Add a reading log + +1. Create a page with the slug `reading-log`. +2. In the page settings, set **Template** to **Reading log**. +3. Optional: add the internal tag `#eyebrow:Reading journal` for the small label above the title, and an excerpt for the text under it. + +The page lists every post and page tagged `#reading`, `#read`, `#want-to-read` and `#did-not-finish`, and shows your number of books read, pages read, average rating and books not finished. Each shelf shows up to 100 posts and 100 pages, newest first, and the numbers count the books on the shelves. The home page links to this page from its "Currently reading" section, and the 404 page links to it too. + +For a book you have not reviewed, create a **page** instead of a post: title, feature image (the cover), and the same internal tags. Pages stay out of your home page, your RSS feed and your email newsletter. Write something in the page body to make the book's card a link to the page. + +## Add an author website + +For authors who want to present their own books: + +1. Create a page, for example with your name as the title. Set **Template** to **Author site**. Its feature image is your portrait, its excerpt is the text under your name, and `#eyebrow:Novelist` sets the label above it. +2. Create a page for each of your books. Tag it `#book`, give it a public tag for the kind of book (for example "Novel"), set its publish date to the book's publication date, and add `#pages:` and `#buy:` if you like. A `#buy:` link must start with `http` or `/`. Mark your newest book as featured to show it as the new release. +3. Anything you write in the author page's body shows below your books. For quotes from reviews and for events, add HTML cards with this markup: + +```html +
+
+

Kind words

+
    +
  • +

    “A novel that rings long after you close it.”

    +
    The Northern Review on The Bell Foundry
    +
  • +
+
+
+``` + +```html +
+
+

Events

+
    +
  • + +
    +

    In conversation: The Bell Foundry

    +

    Wren & Ash Books, York · 7 pm

    +
    + Book a place +
  • +
+
+
+``` + +The newsletter signup section follows when your site lets visitors sign up. + +## Search, members, newsletters and comments + +- **Search**: the search box in the header and on the 404 page opens Ghost's built-in search. +- **Signups**: the newsletter section is a Ghost signup form. It shows when **Settings > Membership** lets visitors sign up and the reader is not signed in. +- **Comments**: when you turn on comments in **Settings > Membership**, they show under each post. +- **Paid content**: Ghost shows its own call to action in place of content a reader cannot access. + +## Templates + +| Template | Used for | +| --- | --- | +| `index.hbs` | The home page and its later pages | +| `post.hbs` | Posts | +| `page.hbs` | Pages, including book pages; it respects "Show title and feature image" | +| `custom-reading-log.hbs` | Template "Reading log" | +| `custom-author-site.hbs` | Template "Author site" | +| `tag.hbs`, `author.hbs` | Tag and author archives | +| `error-404.hbs`, `error.hbs` | Not found and other errors | + +## Translate the theme + +Every interface string is in `locales/en.json`. Copy it to `locales/.json`, translate the values, and set the publication language under **Settings > General**. + +## The footer credit + +The footer says "Published with Ghost" and "Theme by List of Books", with a link to https://www.listofbooks.net/. Both are in `partials/site/credit.hbs`. We ask that you keep the credit; it is how a free theme pays for itself. + +## Develop + +The theme's source lives in the repository https://github.com/listofbooks-net/readerly-theme. `assets/css/readerly.css`, `assets/js/theme.js`, the fonts and the grain images are generated from its `design/` folder, so change them there. `assets/css/ghost.css`, `assets/js/books.js` and the templates are edited here. diff --git a/ghost/assets/css/ghost.css b/ghost/assets/css/ghost.css new file mode 100644 index 0000000..09e5da2 --- /dev/null +++ b/ghost/assets/css/ghost.css @@ -0,0 +1,158 @@ +/* + * Readerly for Ghost: what Ghost needs beyond the shared stylesheet (readerly.css). + * The shared stylesheet is generated from design/; this file is not. + * 1. Ghost settings (custom fonts) + * 2. Theme glue (logo, feature without a cover, pagination total) + * 3. Koenig editor cards + * 4. Members forms and Portal + */ + +/* 1. Ghost settings --------------------------------------------- */ + +/* Design > Typography in Ghost Admin sets these two variables. */ +:root { + --font-heading: var(--gh-font-heading, "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif); + --font-body: var(--gh-font-body, "Literata", "Iowan Old Style", "Palatino Linotype", Georgia, serif); +} + +/* 2. Theme glue -------------------------------------------------- */ + +.site-title--logo img { display: block; max-height: 3rem; width: auto; } + +.feature:not(:has(> .cover-link)) { grid-template-columns: minmax(0, 1fr); } + +.pagination .pagination__total { border: 0; color: var(--color-muted); padding-inline: 0; } + +/* A book's cover sits in the book panel, so the post's feature image would repeat it. */ +.book-panel ~ .entry-figure { display: none; } +.entry-figure { margin-block: var(--space-50) 0; } +.entry-figure img { display: block; width: 100%; height: auto; border-radius: var(--radius); } +.entry-figure figcaption { + margin-top: var(--space-20); + color: var(--color-muted); + font-size: var(--size-small); + text-align: center; +} + +/* Without pagination, a list would end against the footer. */ +main > .wrap > .book-grid--list:last-child { margin-bottom: var(--space-70); } + +.error-details { margin-top: var(--space-50); color: var(--color-muted); font-size: var(--size-small); } + +/* 3. Koenig editor cards ----------------------------------------- */ + +.entry-content .kg-image { display: block; margin-inline: auto; max-width: 100%; height: auto; } + +/* 100vw includes a classic scrollbar, so a full-width card would scroll the page sideways. */ +main { overflow-x: clip; } +.kg-width-wide, +.kg-width-full { position: relative; } +.kg-width-wide { + width: min(var(--width-wide), 100vw - 2 * var(--space-40)); + margin-inline: calc(50% - min(var(--width-wide), 100vw - 2 * var(--space-40)) / 2); +} +.kg-width-full { + width: 100vw; + margin-inline: calc(50% - 50vw); +} +.kg-width-full img, +.entry-content .kg-width-full figure img { border-radius: 0; } +.kg-width-full figcaption { padding-inline: var(--space-40); } + +.kg-gallery-image img { border-radius: var(--radius); } + +.entry-content > blockquote:not([class]) { + padding-left: var(--space-40); + border-left: 2px solid var(--color-accent); + font-style: italic; +} +.entry-content > blockquote.kg-blockquote-alt { + margin-block: var(--space-60); + padding-block: var(--space-40); + border-block: var(--border-width) solid var(--color-contrast); + font-family: var(--font-heading); + font-size: var(--size-x-large); + font-style: italic; + line-height: 1.3; + text-align: center; + text-wrap: balance; +} + +.entry-content pre { + overflow-x: auto; + padding: var(--space-40); + background: var(--color-surface); + border: var(--border-width) solid var(--color-border); + border-radius: var(--radius); + font-size: var(--size-small); +} +.entry-content :not(pre) > code { + padding: 0.1em 0.3em; + background: var(--color-surface); + border-radius: 3px; + font-size: 0.9em; +} + +.kg-bookmark-card a.kg-bookmark-container, +.kg-product-card .kg-product-card-container, +.kg-file-card .kg-file-card-container, +.kg-audio-card, +.kg-toggle-card, +.kg-cta-card { + background: var(--color-surface); + border: var(--border-width) solid var(--color-border); + border-radius: var(--radius); + box-shadow: none; + color: var(--color-contrast); +} +.kg-bookmark-title, +.kg-product-card-title, +.kg-file-card-title, +.kg-toggle-heading-text, +.kg-header-card-heading, +.kg-signup-card-heading, +.kg-cta-heading { + font-family: var(--font-heading); +} +.kg-bookmark-description, +.kg-bookmark-metadata, +.kg-file-card-caption, +.kg-file-card-metadata { color: var(--color-muted); } + +.kg-product-card-rating-active.kg-product-card-rating-star svg { fill: var(--color-accent); } +.kg-product-card .kg-product-card-button, +.kg-button-card a.kg-btn, +.kg-header-card .kg-header-card-button, +.kg-signup-card .kg-signup-card-button, +.kg-cta-card .kg-cta-button { + border-radius: var(--radius); + font-family: var(--font-body); + font-weight: 600; +} +.kg-button-card a.kg-btn-accent, +.kg-product-card a.kg-product-card-btn-accent { + background: var(--color-accent); + color: var(--color-base); +} + +.kg-callout-card { border-radius: var(--radius); } +.kg-callout-card-grey, +.kg-callout-card-white { background: var(--color-surface); } +.kg-callout-card-grey { border: var(--border-width) solid var(--color-border); } +.kg-callout-text { color: inherit; } + +.kg-toggle-card h4.kg-toggle-heading-text { font-size: var(--size-medium); } + +.kg-embed-card { display: flex; flex-direction: column; align-items: center; } +.kg-embed-card > :is(iframe, video) { max-width: 100%; } + +/* 4. Members forms and Portal ------------------------------------ */ + +/* Ghost adds .loading, .success or .error to a form with data-members-form. */ +.newsletter__form .form-status > span { display: none; } +.newsletter__form.success .form-status__success, +.newsletter__form.error .form-status__error { display: inline; } +.newsletter__form.error .form-status { color: var(--color-accent); } +.newsletter__form.success .newsletter__row, +.newsletter__form.success label { display: none; } +.newsletter__form.loading button[type="submit"] { opacity: 0.6; pointer-events: none; } diff --git a/ghost/assets/css/readerly.css b/ghost/assets/css/readerly.css new file mode 100644 index 0000000..a08917b --- /dev/null +++ b/ghost/assets/css/readerly.css @@ -0,0 +1,1402 @@ +/* Readerly for Ghost. 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/ghost/assets/fonts/fraunces/OFL.txt b/ghost/assets/fonts/fraunces/OFL.txt new file mode 100644 index 0000000..1dd6478 --- /dev/null +++ b/ghost/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/ghost/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 b/ghost/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 new file mode 100644 index 0000000..2e65049 Binary files /dev/null and b/ghost/assets/fonts/fraunces/fraunces-latin-ext-standard-italic.woff2 differ diff --git a/ghost/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 b/ghost/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 new file mode 100644 index 0000000..b6e3e3a Binary files /dev/null and b/ghost/assets/fonts/fraunces/fraunces-latin-ext-standard-normal.woff2 differ diff --git a/ghost/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 b/ghost/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 new file mode 100644 index 0000000..b2cf648 Binary files /dev/null and b/ghost/assets/fonts/fraunces/fraunces-latin-standard-italic.woff2 differ diff --git a/ghost/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 b/ghost/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 new file mode 100644 index 0000000..cb295bf Binary files /dev/null and b/ghost/assets/fonts/fraunces/fraunces-latin-standard-normal.woff2 differ diff --git a/ghost/assets/fonts/literata/OFL.txt b/ghost/assets/fonts/literata/OFL.txt new file mode 100644 index 0000000..5030063 --- /dev/null +++ b/ghost/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/ghost/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 b/ghost/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 new file mode 100644 index 0000000..4ae2494 Binary files /dev/null and b/ghost/assets/fonts/literata/literata-latin-ext-standard-italic.woff2 differ diff --git a/ghost/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 b/ghost/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 new file mode 100644 index 0000000..1339f9f Binary files /dev/null and b/ghost/assets/fonts/literata/literata-latin-ext-standard-normal.woff2 differ diff --git a/ghost/assets/fonts/literata/literata-latin-standard-italic.woff2 b/ghost/assets/fonts/literata/literata-latin-standard-italic.woff2 new file mode 100644 index 0000000..87975e1 Binary files /dev/null and b/ghost/assets/fonts/literata/literata-latin-standard-italic.woff2 differ diff --git a/ghost/assets/fonts/literata/literata-latin-standard-normal.woff2 b/ghost/assets/fonts/literata/literata-latin-standard-normal.woff2 new file mode 100644 index 0000000..1f3f137 Binary files /dev/null and b/ghost/assets/fonts/literata/literata-latin-standard-normal.woff2 differ diff --git a/ghost/assets/img/cover-grain.svg b/ghost/assets/img/cover-grain.svg new file mode 100644 index 0000000..e63a3b8 --- /dev/null +++ b/ghost/assets/img/cover-grain.svg @@ -0,0 +1 @@ + diff --git a/ghost/assets/img/paper-grain.svg b/ghost/assets/img/paper-grain.svg new file mode 100644 index 0000000..3138c08 --- /dev/null +++ b/ghost/assets/img/paper-grain.svg @@ -0,0 +1 @@ + diff --git a/ghost/assets/js/books.js b/ghost/assets/js/books.js new file mode 100644 index 0000000..28665ed --- /dev/null +++ b/ghost/assets/js/books.js @@ -0,0 +1,79 @@ +/* + * Readerly for Ghost: numbers that Handlebars cannot compute. + * - Reading progress percentages on "currently reading" cards + * - Shelf counts and the reading statistics on the reading log page + * Without this file the progress bars and shelves still show; the counts and statistics stay hidden. + */ +(function () { + function percent(progress) { + var max = Number(progress.getAttribute("max")); + var value = Number(progress.getAttribute("value")); + if (!(max > 0) || !isFinite(value)) return 0; + return Math.min(100, Math.max(0, Math.round((value / max) * 100))); + } + + function fillProgress() { + Array.prototype.forEach.call(document.querySelectorAll(".progress"), function (box) { + var bar = box.querySelector("progress"); + var slot = box.querySelector("[data-percent]"); + if (!bar || !slot) return; + var text = percent(bar) + "%"; + bar.textContent = text; + slot.textContent = text; + }); + } + + function cards(shelf) { + var list = document.querySelector('[data-shelf="' + shelf + '"]'); + return list ? Array.prototype.slice.call(list.querySelectorAll(".book-card")) : []; + } + + var locale = document.documentElement.lang || undefined; + function format(number, digits) { + try { + return number.toLocaleString(locale, { maximumFractionDigits: digits || 0 }); + } catch (error) { + return String(digits ? Math.round(number * 10) / 10 : number); + } + } + + function fillCounts() { + Array.prototype.forEach.call(document.querySelectorAll("[data-count]"), function (slot) { + var count = cards(slot.getAttribute("data-count")).length; + var label = slot.getAttribute(count === 1 ? "data-one" : "data-many") || "%"; + slot.textContent = label.replace("%", format(count)); + }); + } + + function fillStats() { + var stats = document.querySelector("[data-stats]"); + if (!stats) return; + var read = cards("read"); + if (!read.length) return; + var pages = 0; + var ratings = []; + read.forEach(function (card) { + pages += Number(card.getAttribute("data-pages")) || 0; + var rating = parseFloat(card.getAttribute("data-rating")); + if (isFinite(rating)) ratings.push(rating); + }); + var values = { + read: format(read.length), + pages: pages ? format(pages) : "", + rating: ratings.length ? format(ratings.reduce(function (a, b) { return a + b; }, 0) / ratings.length, 1) : "", + dnf: format(cards("dnf").length), + }; + Array.prototype.forEach.call(stats.querySelectorAll("[data-stat]"), function (slot) { + var value = values[slot.getAttribute("data-stat")]; + if (value) slot.textContent = value; + else if (slot.closest("li")) slot.closest("li").hidden = true; + }); + stats.hidden = false; + } + + document.addEventListener("DOMContentLoaded", function () { + fillProgress(); + fillCounts(); + fillStats(); + }); +})(); diff --git a/ghost/assets/js/theme.js b/ghost/assets/js/theme.js new file mode 100644 index 0000000..ed66ec6 --- /dev/null +++ b/ghost/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/ghost/author.hbs b/ghost/author.hbs new file mode 100644 index 0000000..e926468 --- /dev/null +++ b/ghost/author.hbs @@ -0,0 +1,21 @@ +{{!< default}} +
+ {{#author}} +
+ {{t "Reviewer"}} +

{{name}}

+ {{#if bio}} +

{{bio}}

+ {{/if}} +

{{plural ../pagination.total empty=(t "No reviews") singular=(t "% review") plural=(t "% reviews")}}{{#if location}} · {{location}}{{/if}}{{#match ../pagination.pages ">" 1}} · {{t "Page {page} of {pages}" page=../pagination.page pages=../pagination.pages}}{{/match}}

+ {{#has any="website, twitter, facebook"}} + + {{/has}} +
+ {{/author}} + {{> "archive-list"}} +
diff --git a/ghost/custom-author-site.hbs b/ghost/custom-author-site.hbs new file mode 100644 index 0000000..ee60e9e --- /dev/null +++ b/ghost/custom-author-site.hbs @@ -0,0 +1,66 @@ +{{!< default}} +{{!-- Template name shown in Ghost Admin: "Author site". --}} +{{#post}} +
+
+
+ {{#if feature_image}} +
+ {{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{t +
+ {{/if}} +
+ {{> "book/eyebrow"}} +

{{title}}

+ {{#if custom_excerpt}} +

{{custom_excerpt}}

+ {{/if}} +
+ {{#get "pages" include="tags" filter="tag:hash-book+featured:true" limit="1" as |release|}}{{#foreach release}}{{t "Discover {title}" title=title}}{{/foreach}}{{/get}} + {{#if @site.members_enabled}}{{#unless @site.members_invite_only}}{{#unless @member}}{{#if @custom.newsletter_heading}}{{t "Join my newsletter"}}{{/if}}{{/unless}}{{/unless}}{{/if}} +
+
+
+
+
+{{#get "pages" include="tags" filter="tag:hash-book+featured:true" limit="1" as |release|}}{{#foreach release}} +
+
+
+
{{> "book/cover" described=true}}
+
+ {{t "New release"}} +

{{title}}

+ {{#if custom_excerpt}} +

{{custom_excerpt}}

+ {{/if}} +

{{#primary_tag}}{{name}} · {{/primary_tag}}{{#foreach tags visibility="internal"}}{{#match name "~^" "#pages:"}}{{t "{pages} pages" pages=(split name separator="#pages:")}} · {{/match}}{{/foreach}}{{t "Published {date}" date=(date published_at format="D MMMM YYYY")}}

+
+ {{> "book/buy-link" label=(t "Buy the book")}} + {{t "Read more about {title}" title=title}} +
+
+
+
+
+{{/foreach}}{{/get}} +{{#get "pages" include="tags" filter="tag:hash-book" limit="12" order="published_at desc" as |books pagination|}}{{#if books}} +
+
+
+

{{t "My books"}}

+

{{plural pagination.total empty="" singular=(t "% book") plural=(t "% books")}}

+
+
    + {{#foreach books}} +
  • + {{> "book/card" variant="own"}} +
  • + {{/foreach}} +
+
+
+{{/if}}{{/get}} +{{content}} +{{> "sections/newsletter"}} +{{/post}} diff --git a/ghost/custom-reading-log.hbs b/ghost/custom-reading-log.hbs new file mode 100644 index 0000000..5bba49a --- /dev/null +++ b/ghost/custom-reading-log.hbs @@ -0,0 +1,36 @@ +{{!< default}} +{{!-- Template name shown in Ghost Admin: "Reading log". --}} +{{#post}} +
+
+
+ {{> "book/eyebrow"}} +

{{title}}

+ {{#if custom_excerpt}} +

{{custom_excerpt}}

+ {{/if}} +
+ +
+
+{{#get "posts" include="tags,authors" filter="tag:hash-reading" limit="100" order="published_at desc" as |reading_posts|}}{{#get "pages" include="tags" filter="tag:hash-reading" limit="100" order="published_at desc" as |reading_pages|}}{{> "sections/reading-now" shelf_posts=reading_posts shelf_pages=reading_pages show_count=true}}{{/get}}{{/get}} +
+
+ {{#get "posts" include="tags,authors" filter="tag:hash-read" limit="100" order="published_at desc" as |read_posts|}}{{#get "pages" include="tags" filter="tag:hash-read" limit="100" order="published_at desc" as |read_pages|}}{{> "sections/shelf" shelf_posts=read_posts shelf_pages=read_pages shelf="read" heading=(t "Read") note=(t "Newest first")}}{{/get}}{{/get}} + {{#get "posts" include="tags,authors" filter="tag:hash-want-to-read" limit="100" order="published_at desc" as |want_posts|}}{{#get "pages" include="tags" filter="tag:hash-want-to-read" limit="100" order="published_at desc" as |want_pages|}}{{> "sections/shelf" shelf_posts=want_posts shelf_pages=want_pages shelf="want" heading=(t "Want to read") note=(t "Up next")}}{{/get}}{{/get}} + {{#get "posts" include="tags,authors" filter="tag:hash-did-not-finish" limit="100" order="published_at desc" as |dnf_posts|}}{{#get "pages" include="tags" filter="tag:hash-did-not-finish" limit="100" order="published_at desc" as |dnf_pages|}}{{> "sections/shelf" shelf_posts=dnf_posts shelf_pages=dnf_pages shelf="dnf" heading=(t "Did not finish") note=(t "Set aside for now")}}{{/get}}{{/get}} +
+
+{{#if html}} +
+
+ {{content}} +
+
+{{/if}} +{{/post}} diff --git a/ghost/default.hbs b/ghost/default.hbs new file mode 100644 index 0000000..28f7c81 --- /dev/null +++ b/ghost/default.hbs @@ -0,0 +1,25 @@ + + + + + + {{meta_title}} + + + + + + + + {{ghost_head}} + + + + {{> "site/header"}} +
+{{{body}}} +
+ {{> "site/footer"}} + {{ghost_foot}} + + diff --git a/ghost/error-404.hbs b/ghost/error-404.hbs new file mode 100644 index 0000000..6be189d --- /dev/null +++ b/ghost/error-404.hbs @@ -0,0 +1,28 @@ +{{!< default}} +
+
+ +

{{t "This page has wandered off the shelf"}}

+

{{t "The link may be old, or the page may have been moved or renamed. Try a search, or start again from the front page."}}

+ {{> "site/search-form" id="search-404" placeholder=(t "Search by title, author or genre")}} +
+ {{t "Back to the front page"}} + {{#get "pages" include="tags" filter="slug:reading-log" limit="1" as |log_pages|}}{{#foreach log_pages}}{{t "See my reading log"}}{{/foreach}}{{/get}} +
+
+ {{#get "posts" include="tags,authors" filter="tag:[hash-rating-5,hash-rating-4-5]" limit="8" as |favourites|}}{{#if favourites}} +
+
+

{{t "Or pick something to read"}}

+

{{t "Recent favourites"}}

+
+
    + {{#foreach favourites}} +
  • + {{> "book/card" variant="compact" link=true}} +
  • + {{/foreach}} +
+
+ {{/if}}{{/get}} +
diff --git a/ghost/error.hbs b/ghost/error.hbs new file mode 100644 index 0000000..32a1746 --- /dev/null +++ b/ghost/error.hbs @@ -0,0 +1,17 @@ +{{!< default}} +
+
+ +

{{message}}

+ +
+ {{#if errorDetails}} +
    + {{#foreach errorDetails}} +
  • {{{rule}}} {{#foreach failures}}{{{message}}} {{/foreach}}
  • + {{/foreach}} +
+ {{/if}} +
diff --git a/ghost/index.hbs b/ghost/index.hbs new file mode 100644 index 0000000..4a027b6 --- /dev/null +++ b/ghost/index.hbs @@ -0,0 +1,13 @@ +{{!< default}} +{{#is "paged"}} +{{> "sections/recent"}} +{{else}} +{{> "sections/intro"}} +{{#foreach posts limit="1"}} +{{> "sections/feature"}} +{{/foreach}} +{{#match posts.length ">" 1}}{{> "sections/recent"}}{{/match}} +{{#if @custom.show_currently_reading}}{{#get "posts" include="tags,authors" filter="tag:hash-reading" limit="12" as |reading_posts|}}{{#get "pages" include="tags" filter="tag:hash-reading" limit="12" as |reading_pages|}}{{> "sections/reading-now" shelf_posts=reading_posts shelf_pages=reading_pages show_log_link=true}}{{/get}}{{/get}}{{/if}} +{{#if @custom.show_genres}}{{> "sections/genres"}}{{/if}} +{{> "sections/newsletter"}} +{{/is}} diff --git a/ghost/locales/en.json b/ghost/locales/en.json new file mode 100644 index 0000000..d492918 --- /dev/null +++ b/ghost/locales/en.json @@ -0,0 +1,96 @@ +{ + "{pages} pages": "{pages} pages", + "{shelf}, scrollable shelf": "{shelf}, scrollable shelf", + "% book": "% book", + "% books": "% books", + "% review": "% review", + "% review so far": "% review so far", + "% reviews": "% reviews", + "% reviews and counting": "% reviews and counting", + "About {name}": "About {name}", + "about {title}": "about {title}", + "Average rating": "Average rating", + "Back to the front page": "Back to the front page", + "Books read": "Books read", + "Browse": "Browse", + "Browse by genre": "Browse by genre", + "Buy": "Buy", + "Buy the book": "Buy the book", + "By": "By", + "by {author}": "by {author}", + "Comments": "Comments", + "Cover of {title}": "Cover of {title}", + "Currently reading": "Currently reading", + "Dark theme": "Dark theme", + "Did not finish": "Did not finish", + "Discover {title}": "Discover {title}", + "DNF": "DNF", + "Elsewhere": "Elsewhere", + "Email address": "Email address", + "Featured": "Featured", + "Featured review": "Featured review", + "Genre": "Genre", + "Genres and tags": "Genres and tags", + "Join my newsletter": "Join my newsletter", + "Latest review": "Latest review", + "Learn more": "Learn more", + "More": "More", + "More from {name}": "More from {name}", + "More in {genre}": "More in {genre}", + "My books": "My books", + "My rating": "My rating", + "My reading log": "My reading log", + "New release": "New release", + "Newer": "Newer", + "Newest first": "Newest first", + "No cover image yet: {title}": "No cover image yet: {title}", + "No reviews": "No reviews", + "No reviews yet": "No reviews yet", + "of {pages}": "of {pages}", + "Older": "Older", + "Older reviews": "Older reviews", + "Or pick something to read": "Or pick something to read", + "Other genres": "Other genres", + "Page": "Page", + "Page {page} of {pages}": "Page {page} of {pages}", + "Pages": "Pages", + "Pages read": "Pages read", + "Pagination": "Pagination", + "Portrait of {name}": "Portrait of {name}", + "Primary": "Primary", + "Progress through {title}": "Progress through {title}", + "Published": "Published", + "Published {date}": "Published {date}", + "Published with Ghost": "Published with Ghost", + "Rated {rating} out of 5": "Rated {rating} out of 5", + "Read": "Read", + "Read more about {title}": "Read more about {title}", + "Read the review": "Read the review", + "Reading": "Reading", + "Reading statistics": "Reading statistics", + "Recent favourites": "Recent favourites", + "Recent reviews": "Recent reviews", + "Reviewed by": "Reviewed by", + "Reviewer": "Reviewer", + "reviews": "reviews", + "Reviews": "Reviews", + "Search": "Search", + "Search by title, author or genre": "Search by title, author or genre", + "Search reviews": "Search reviews", + "See my reading log": "See my reading log", + "Series": "Series", + "Set aside for now": "Set aside for now", + "Skip to content": "Skip to content", + "Status": "Status", + "Stopped at page {page}": "Stopped at page {page}", + "Subscribe": "Subscribe", + "Thank you. Please check your inbox to confirm your subscription.": "Thank you. Please check your inbox to confirm your subscription.", + "The link may be old, or the page may have been moved or renamed. Try a search, or start again from the front page.": "The link may be old, or the page may have been moved or renamed. Try a search, or start again from the front page.", + "Theme by List of Books": "Theme by List of Books", + "This page has wandered off the shelf": "This page has wandered off the shelf", + "Up next": "Up next", + "Want to read": "Want to read", + "Website": "Website", + "You might also like": "You might also like", + "you@example.com": "you@example.com" +} diff --git a/ghost/package.json b/ghost/package.json new file mode 100644 index 0000000..dadf541 --- /dev/null +++ b/ghost/package.json @@ -0,0 +1,121 @@ +{ + "name": "readerly", + "description": "A theme for book blogs, author websites and reading logs, in a light style (Paper) and a dark style (Lamplight).", + "version": "1.0.0", + "license": "MIT", + "author": { + "name": "List of Books", + "email": "contact@listofbooks.net", + "url": "https://www.listofbooks.net/" + }, + "homepage": "https://www.listofbooks.net/themes/readerly", + "repository": { + "type": "git", + "url": "https://github.com/listofbooks-net/readerly-theme.git" + }, + "bugs": "https://github.com/listofbooks-net/readerly-theme/issues", + "keywords": ["ghost", "theme", "ghost-theme", "books", "book-reviews", "reading-log", "author", "dark-mode"], + "engines": { + "ghost": ">=6.0.0" + }, + "config": { + "posts_per_page": 9, + "image_sizes": { + "xs": { "width": 160 }, + "s": { "width": 320 }, + "m": { "width": 600 }, + "l": { "width": 960 }, + "xl": { "width": 1200 }, + "xxl": { "width": 2000 } + }, + "card_assets": true, + "custom": { + "color_scheme": { + "type": "select", + "options": ["Auto", "Paper", "Lamplight"], + "default": "Auto", + "description": "Paper is light and Lamplight is dark. Auto follows each reader's system setting." + }, + "style_toggle": { + "type": "boolean", + "default": true, + "description": "Show a button in the header that switches between Paper and Lamplight." + }, + "footer_about": { + "type": "text", + "description": "One or two sentences under the site title in the footer." + }, + "secondary_navigation_title": { + "type": "text", + "default": "Genres", + "description": "Heading of the secondary navigation in the footer." + }, + "copyright_note": { + "type": "text", + "description": "Text after the copyright line, for example: All reviews are my own." + }, + "intro_eyebrow": { + "type": "text", + "group": "homepage" + }, + "intro_heading": { + "type": "text", + "group": "homepage", + "description": "Wrap words in *asterisks* to set them in italics. Leave empty to hide the introduction." + }, + "intro_lead": { + "type": "text", + "group": "homepage" + }, + "intro_button_text": { + "type": "text", + "default": "Read the latest review", + "group": "homepage", + "description": "Links to your newest post. Leave empty to hide the button." + }, + "secondary_button_text": { + "type": "text", + "group": "homepage" + }, + "secondary_button_url": { + "type": "text", + "group": "homepage" + }, + "show_currently_reading": { + "type": "boolean", + "default": true, + "group": "homepage", + "description": "Books tagged #reading, when there are any." + }, + "show_genres": { + "type": "boolean", + "default": true, + "group": "homepage" + }, + "newsletter_eyebrow": { + "type": "text", + "group": "homepage" + }, + "newsletter_heading": { + "type": "text", + "default": "Get new reviews by email.", + "group": "homepage", + "description": "Shown when your site has signups turned on." + }, + "newsletter_note": { + "type": "text", + "group": "homepage" + }, + "show_related_reviews": { + "type": "boolean", + "default": true, + "group": "post" + }, + "show_reviewer_bio": { + "type": "boolean", + "default": true, + "group": "post" + } + } + } +} diff --git a/ghost/page.hbs b/ghost/page.hbs new file mode 100644 index 0000000..af00c0b --- /dev/null +++ b/ghost/page.hbs @@ -0,0 +1,26 @@ +{{!< default}} +{{#post}} +
+ {{#match @page.show_title_and_feature_image}} +
+ {{> "book/eyebrow"}} +

{{title}}

+ {{#if custom_excerpt}} +

{{custom_excerpt}}

+ {{/if}} +
+ {{/match}} + + {{> "book/panel"}} + {{#match @page.show_title_and_feature_image}}{{#if feature_image}} +
+ {{feature_image_alt}} + {{#if feature_image_caption}}
{{feature_image_caption}}
{{/if}} +
+ {{/if}}{{/match}} + +
+ {{content}} +
+
+{{/post}} diff --git a/ghost/partials/archive-list.hbs b/ghost/partials/archive-list.hbs new file mode 100644 index 0000000..504cc54 --- /dev/null +++ b/ghost/partials/archive-list.hbs @@ -0,0 +1,8 @@ +
    + {{#foreach posts}} +
  • + {{> "book/card" heading="h2" blurb="full"}} +
  • + {{/foreach}} +
+ {{pagination}} \ No newline at end of file diff --git a/ghost/partials/book/author.hbs b/ghost/partials/book/author.hbs new file mode 100644 index 0000000..4933521 --- /dev/null +++ b/ghost/partials/book/author.hbs @@ -0,0 +1 @@ +{{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}{{#if ../plain}}{{split name separator="#by:"}}{{else}}{{t "by {author}" author=(split name separator="#by:")}}{{/if}}{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/badge.hbs b/ghost/partials/book/badge.hbs new file mode 100644 index 0000000..4cf40c0 --- /dev/null +++ b/ghost/partials/book/badge.hbs @@ -0,0 +1 @@ +{{#foreach tags visibility="internal"}}{{#match slug "hash-reading"}}{{t "Reading"}}{{else match slug "hash-read"}}{{t "Read"}}{{else match slug "hash-want-to-read"}}{{t "Want to read"}}{{else match slug "hash-did-not-finish"}}{{t "DNF"}}{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/buy-link.hbs b/ghost/partials/book/buy-link.hbs new file mode 100644 index 0000000..3eabb88 --- /dev/null +++ b/ghost/partials/book/buy-link.hbs @@ -0,0 +1 @@ +{{#foreach tags visibility="internal"}}{{#match name "~^" "#buy:http"}}{{../label}}{{#if ../hidden}} {{../hidden}}{{/if}}{{else match name "~^" "#buy:/"}}{{../label}}{{#if ../hidden}} {{../hidden}}{{/if}}{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/card-cover.hbs b/ghost/partials/book/card-cover.hbs new file mode 100644 index 0000000..89bdb3b --- /dev/null +++ b/ghost/partials/book/card-cover.hbs @@ -0,0 +1 @@ +{{#if link}}{{else}}
{{> "book/cover" described=true}}
{{/if}} \ No newline at end of file diff --git a/ghost/partials/book/card.hbs b/ghost/partials/book/card.hbs new file mode 100644 index 0000000..ae0bf02 --- /dev/null +++ b/ghost/partials/book/card.hbs @@ -0,0 +1,40 @@ +{{#match variant "compact"}} +
"book/data"}}> + {{#if feature_image}}{{> "book/card-cover" link=link}}{{else}}{{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}{{> "book/card-cover" ../this link=../link}}{{/match}}{{/foreach}}{{/if}} +
+ <{{#if heading}}{{heading}}{{else}}h3{{/if}} class="book-card__title">{{#if link}}{{title}}{{else}}{{title}}{{/if}} + {{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}

{{split name separator="#by:"}}

{{/match}}{{/foreach}} + {{#has tag="#reading,#read,#want-to-read,#did-not-finish"}}
{{> "book/rating"}}{{> "book/badge"}}
{{else}}{{#foreach tags visibility="internal"}}{{#match ",#rating:0,#rating:0.5,#rating:1,#rating:1.5,#rating:2,#rating:2.5,#rating:3,#rating:3.5,#rating:4,#rating:4.5,#rating:5," "~" (concat "," name ",")}}
{{> "book/stars" value=(split name separator="#rating:")}}
{{/match}}{{/foreach}}{{/has}} + {{> "book/progress"}} +
+
+{{else match variant "own"}} + +{{else}} +
"book/data"}}> + {{#if feature_image}}{{> "book/card-cover" link=true}}{{else}}{{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}{{> "book/card-cover" ../this link=true}}{{/match}}{{/foreach}}{{/if}} +
+ {{#if featured}}{{t "Featured"}}{{#primary_tag}} · {{name}}{{/primary_tag}}{{else}}{{#primary_tag}}{{name}}{{/primary_tag}}{{/if}} + <{{#if heading}}{{heading}}{{else}}h3{{/if}} class="book-card__title">{{title}} + {{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}

{{t "by {author}" author=(split name separator="#by:")}}

{{/match}}{{/foreach}} + {{#foreach tags visibility="internal"}}{{#match ",#rating:0,#rating:0.5,#rating:1,#rating:1.5,#rating:2,#rating:2.5,#rating:3,#rating:3.5,#rating:4,#rating:4.5,#rating:5," "~" (concat "," name ",")}}
{{> "book/stars" value=(split name separator="#rating:")}}
{{/match}}{{/foreach}} + {{#if blurb}} +

{{#if custom_excerpt}}{{custom_excerpt}}{{else}}{{excerpt words="40"}}{{/if}}

+ {{/if}} +

+
+
+{{/match}} \ No newline at end of file diff --git a/ghost/partials/book/cover.hbs b/ghost/partials/book/cover.hbs new file mode 100644 index 0000000..56a04b0 --- /dev/null +++ b/ghost/partials/book/cover.hbs @@ -0,0 +1 @@ +{{#if feature_image}}{{#if described}}{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{t {{else}}{{/if}} \ No newline at end of file diff --git a/ghost/partials/book/data.hbs b/ghost/partials/book/data.hbs new file mode 100644 index 0000000..2632be6 --- /dev/null +++ b/ghost/partials/book/data.hbs @@ -0,0 +1 @@ +{{#foreach tags visibility="internal"}}{{#match ",#rating:0,#rating:0.5,#rating:1,#rating:1.5,#rating:2,#rating:2.5,#rating:3,#rating:3.5,#rating:4,#rating:4.5,#rating:5," "~" (concat "," name ",")}} data-rating="{{split name separator="#rating:"}}"{{/match}}{{#match name "~^" "#pages:"}} data-pages="{{split name separator="#pages:"}}"{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/eyebrow.hbs b/ghost/partials/book/eyebrow.hbs new file mode 100644 index 0000000..b649c07 --- /dev/null +++ b/ghost/partials/book/eyebrow.hbs @@ -0,0 +1 @@ +{{#foreach tags visibility="internal"}}{{#match name "~^" "#eyebrow:"}}{{split name separator="#eyebrow:"}}{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/json-ld.hbs b/ghost/partials/book/json-ld.hbs new file mode 100644 index 0000000..b084275 --- /dev/null +++ b/ghost/partials/book/json-ld.hbs @@ -0,0 +1,3 @@ +{{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}{{#foreach ../tags visibility="internal"}}{{#match ",#rating:0,#rating:0.5,#rating:1,#rating:1.5,#rating:2,#rating:2.5,#rating:3,#rating:3.5,#rating:4,#rating:4.5,#rating:5," "~" (concat "," name ",")}} + +{{/match}}{{/foreach}}{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/panel.hbs b/ghost/partials/book/panel.hbs new file mode 100644 index 0000000..33483cc --- /dev/null +++ b/ghost/partials/book/panel.hbs @@ -0,0 +1,31 @@ +{{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}} + +{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/progress.hbs b/ghost/partials/book/progress.hbs new file mode 100644 index 0000000..798f966 --- /dev/null +++ b/ghost/partials/book/progress.hbs @@ -0,0 +1 @@ +{{#has tag="#reading"}}{{#foreach tags visibility="internal"}}{{#match name "~^" "#on-page:"}}{{#foreach ../tags visibility="internal"}}{{#match name "~^" "#pages:"}}

{{t "Page {page} of {pages}" page=(split ../name separator="#on-page:") pages=(split name separator="#pages:")}}

{{/match}}{{/foreach}}{{/match}}{{/foreach}}{{/has}}{{#has tag="#did-not-finish"}}{{#foreach tags visibility="internal"}}{{#match name "~^" "#on-page:"}}

{{t "Stopped at page {page}" page=(split name separator="#on-page:")}}

{{/match}}{{/foreach}}{{/has}} \ No newline at end of file diff --git a/ghost/partials/book/rating.hbs b/ghost/partials/book/rating.hbs new file mode 100644 index 0000000..54fe252 --- /dev/null +++ b/ghost/partials/book/rating.hbs @@ -0,0 +1 @@ +{{#foreach tags visibility="internal"}}{{#match ",#rating:0,#rating:0.5,#rating:1,#rating:1.5,#rating:2,#rating:2.5,#rating:3,#rating:3.5,#rating:4,#rating:4.5,#rating:5," "~" (concat "," name ",")}}{{> "book/stars" value=(split name separator="#rating:") large=../large}}{{/match}}{{/foreach}} \ No newline at end of file diff --git a/ghost/partials/book/stars.hbs b/ghost/partials/book/stars.hbs new file mode 100644 index 0000000..6a9f197 --- /dev/null +++ b/ghost/partials/book/stars.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ghost/partials/navigation.hbs b/ghost/partials/navigation.hbs new file mode 100644 index 0000000..98ec4b5 --- /dev/null +++ b/ghost/partials/navigation.hbs @@ -0,0 +1,7 @@ + + {{#foreach navigation}} + {{#if label}} +
  • {{label}}
  • + {{/if}} + {{/foreach}} + \ No newline at end of file diff --git a/ghost/partials/pagination.hbs b/ghost/partials/pagination.hbs new file mode 100644 index 0000000..4ddd78e --- /dev/null +++ b/ghost/partials/pagination.hbs @@ -0,0 +1,18 @@ +{{#match pages ">" 1}} + +{{/match}} \ No newline at end of file diff --git a/ghost/partials/sections/feature.hbs b/ghost/partials/sections/feature.hbs new file mode 100644 index 0000000..2517706 --- /dev/null +++ b/ghost/partials/sections/feature.hbs @@ -0,0 +1,18 @@ +
    +
    +
    + {{#if feature_image}}{{else}}{{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}{{/match}}{{/foreach}}{{/if}} +
    + {{#if featured}}{{t "Featured review"}}{{else}}{{t "Latest review"}}{{/if}}{{#primary_tag}} · {{name}}{{/primary_tag}} +

    {{title}}

    + {{#foreach tags visibility="internal"}}{{#match name "~^" "#by:"}}

    {{t "by {author}" author=(split name separator="#by:")}}{{#foreach ../tags visibility="internal"}}{{#match name "~^" "#series:"}} · {{split name separator="#series:"}}{{/match}}{{/foreach}}

    {{/match}}{{/foreach}} + {{#foreach tags visibility="internal"}}{{#match ",#rating:0,#rating:0.5,#rating:1,#rating:1.5,#rating:2,#rating:2.5,#rating:3,#rating:3.5,#rating:4,#rating:4.5,#rating:5," "~" (concat "," name ",")}}
    {{> "book/stars" value=(split name separator="#rating:") large=true}}
    {{/match}}{{/foreach}} + {{#if excerpt}} +

    {{#if custom_excerpt}}{{custom_excerpt}}{{else}}{{excerpt words="50"}}{{/if}}

    + {{/if}} +

    · {{reading_time}}

    + {{t "Read the review"}} {{> "site/icon" name="arrow-right"}} +
    +
    +
    +
    \ No newline at end of file diff --git a/ghost/partials/sections/genres.hbs b/ghost/partials/sections/genres.hbs new file mode 100644 index 0000000..9a57fad --- /dev/null +++ b/ghost/partials/sections/genres.hbs @@ -0,0 +1,15 @@ +{{#get "tags" limit="8" include="count.posts" order="count.posts desc" filter="visibility:public" as |genres|}}{{#if genres}} +
    +
    +
    +

    {{t "Browse by genre"}}

    +

    {{plural @root.pagination.total empty=(t "No reviews yet") singular=(t "% review so far") plural=(t "% reviews and counting")}}

    +
    + +
    +
    +{{/if}}{{/get}} \ No newline at end of file diff --git a/ghost/partials/sections/intro.hbs b/ghost/partials/sections/intro.hbs new file mode 100644 index 0000000..011c969 --- /dev/null +++ b/ghost/partials/sections/intro.hbs @@ -0,0 +1,25 @@ +{{#if @custom.intro_heading}} +
    +
    +
    + {{#if @custom.intro_eyebrow}} + {{@custom.intro_eyebrow}} + {{/if}} +

    {{#split @custom.intro_heading separator="*"}}{{#foreach this}}{{#if @even}}{{this}}{{else}}{{this}}{{/if}}{{/foreach}}{{/split}}

    + {{#if @custom.intro_lead}} +

    {{@custom.intro_lead}}

    + {{/if}} + {{#if @custom.intro_button_text}}{{#foreach posts limit="1"}} +
    + {{@custom.intro_button_text}} + {{#if @custom.secondary_button_text}}{{#if @custom.secondary_button_url}} + {{@custom.secondary_button_text}} + {{/if}}{{/if}} +
    + {{/foreach}}{{/if}} +
    +
    +
    +{{else}} +

    {{@site.title}}

    +{{/if}} \ No newline at end of file diff --git a/ghost/partials/sections/newsletter.hbs b/ghost/partials/sections/newsletter.hbs new file mode 100644 index 0000000..08ead25 --- /dev/null +++ b/ghost/partials/sections/newsletter.hbs @@ -0,0 +1,25 @@ +{{#if @site.members_enabled}}{{#unless @site.members_invite_only}}{{#unless @member}}{{#if @custom.newsletter_heading}} +
    +
    + +
    +
    +{{/if}}{{/unless}}{{/unless}}{{/if}} \ No newline at end of file diff --git a/ghost/partials/sections/reading-now-body.hbs b/ghost/partials/sections/reading-now-body.hbs new file mode 100644 index 0000000..5870999 --- /dev/null +++ b/ghost/partials/sections/reading-now-body.hbs @@ -0,0 +1,20 @@ +
    +
    +
    +

    {{t "Currently reading"}}{{#if show_count}} {{/if}}

    + {{#if show_log_link}}{{#get "pages" include="tags" filter="slug:reading-log" limit="1" as |log_pages|}}{{#foreach log_pages}}{{t "My reading log"}} {{> "site/icon" name="arrow-right"}}{{/foreach}}{{/get}}{{/if}} +
    +
      + {{#foreach shelf_posts}} +
    • + {{> "book/card" variant="compact" link=true}} +
    • + {{/foreach}} + {{#foreach shelf_pages}} +
    • + {{> "book/card" variant="compact" link=html}} +
    • + {{/foreach}} +
    +
    +
    \ No newline at end of file diff --git a/ghost/partials/sections/reading-now.hbs b/ghost/partials/sections/reading-now.hbs new file mode 100644 index 0000000..7467980 --- /dev/null +++ b/ghost/partials/sections/reading-now.hbs @@ -0,0 +1 @@ +{{#if shelf_posts}}{{> "sections/reading-now-body"}}{{else if shelf_pages}}{{> "sections/reading-now-body"}}{{/if}} \ No newline at end of file diff --git a/ghost/partials/sections/recent.hbs b/ghost/partials/sections/recent.hbs new file mode 100644 index 0000000..f9eeb6f --- /dev/null +++ b/ghost/partials/sections/recent.hbs @@ -0,0 +1,28 @@ +
    +
    +
    + {{#is "paged"}} +

    {{t "Reviews"}} {{t "Page {page} of {pages}" page=pagination.page pages=pagination.pages}}

    + {{else}} +

    {{t "Recent reviews"}}

    + {{#if pagination.next}}{{t "Older reviews"}} {{> "site/icon" name="arrow-right"}}{{/if}} + {{/is}} +
    +
      + {{#is "paged"}} + {{#foreach posts}} +
    • + {{> "book/card" blurb="clamp"}} +
    • + {{/foreach}} + {{else}} + {{#foreach posts from="2"}} +
    • + {{> "book/card" blurb="clamp"}} +
    • + {{/foreach}} + {{/is}} +
    + {{pagination}} +
    +
    \ No newline at end of file diff --git a/ghost/partials/sections/shelf-body.hbs b/ghost/partials/sections/shelf-body.hbs new file mode 100644 index 0000000..1681214 --- /dev/null +++ b/ghost/partials/sections/shelf-body.hbs @@ -0,0 +1,20 @@ +
    +
    +

    {{heading}}

    + {{#if note}} +

    {{note}}

    + {{/if}} +
    +
      + {{#foreach shelf_posts}} +
    • + {{> "book/card" variant="compact" link=true}} +
    • + {{/foreach}} + {{#foreach shelf_pages}} +
    • + {{> "book/card" variant="compact" link=html}} +
    • + {{/foreach}} +
    +
    \ No newline at end of file diff --git a/ghost/partials/sections/shelf.hbs b/ghost/partials/sections/shelf.hbs new file mode 100644 index 0000000..8e08420 --- /dev/null +++ b/ghost/partials/sections/shelf.hbs @@ -0,0 +1 @@ +{{#if shelf_posts}}{{> "sections/shelf-body"}}{{else if shelf_pages}}{{> "sections/shelf-body"}}{{/if}} \ No newline at end of file diff --git a/ghost/partials/site/credit.hbs b/ghost/partials/site/credit.hbs new file mode 100644 index 0000000..844e601 --- /dev/null +++ b/ghost/partials/site/credit.hbs @@ -0,0 +1 @@ +

    {{t "Published with Ghost"}} · {{t "Theme by List of Books"}}

    \ No newline at end of file diff --git a/ghost/partials/site/footer.hbs b/ghost/partials/site/footer.hbs new file mode 100644 index 0000000..e7ef051 --- /dev/null +++ b/ghost/partials/site/footer.hbs @@ -0,0 +1,28 @@ +
    +
    + + +
    +
    \ No newline at end of file diff --git a/ghost/partials/site/header.hbs b/ghost/partials/site/header.hbs new file mode 100644 index 0000000..223665d --- /dev/null +++ b/ghost/partials/site/header.hbs @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/ghost/partials/site/icon.hbs b/ghost/partials/site/icon.hbs new file mode 100644 index 0000000..153a00d --- /dev/null +++ b/ghost/partials/site/icon.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ghost/partials/site/search-form.hbs b/ghost/partials/site/search-form.hbs new file mode 100644 index 0000000..0978b6e --- /dev/null +++ b/ghost/partials/site/search-form.hbs @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/ghost/post.hbs b/ghost/post.hbs new file mode 100644 index 0000000..22c422e --- /dev/null +++ b/ghost/post.hbs @@ -0,0 +1,77 @@ +{{!< default}} +{{#post}} +
    +
    +
    + {{#if primary_tag}} +
      + {{#foreach tags}} +
    • {{name}}
    • + {{/foreach}} +
    + {{/if}} +

    {{title}}

    + {{#if custom_excerpt}} +

    {{custom_excerpt}}

    + {{/if}} + +
    + + {{> "book/panel"}} + {{#if feature_image}} +
    + {{feature_image_alt}} + {{#if feature_image_caption}}
    {{feature_image_caption}}
    {{/if}} +
    + {{/if}} + +
    + {{content}} +
    + + {{#if @custom.show_reviewer_bio}}{{#primary_author}}{{#if bio}} + + {{/if}}{{/primary_author}}{{/if}} + + {{#if @custom.show_related_reviews}}{{#if primary_tag}} + {{#get "posts" include="tags,authors" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related|}}{{#if related}} +
    +
    + + {{#with ../primary_tag}}{{t "More in {genre}" genre=name}} {{> "site/icon" name="arrow-right"}}{{/with}} +
    + +
    + {{/if}}{{/get}} + {{/if}}{{/if}} + + {{#if comments}} +
    +
    +

    {{t "Comments"}}

    +
    + {{comments title="" count=false}} +
    + {{/if}} +
    +
    +{{> "book/json-ld"}} +{{/post}} diff --git a/ghost/tag.hbs b/ghost/tag.hbs new file mode 100644 index 0000000..be24d8c --- /dev/null +++ b/ghost/tag.hbs @@ -0,0 +1,21 @@ +{{!< default}} +
    + {{#tag}} +
    + {{t "Genre"}} +

    {{name}}

    + {{#if description}} +

    {{description}}

    + {{/if}} +

    {{plural ../pagination.total empty=(t "No reviews") singular=(t "% review") plural=(t "% reviews")}}{{#match ../pagination.pages ">" 1}} · {{t "Page {page} of {pages}" page=../pagination.page pages=../pagination.pages}}{{/match}}

    + {{#get "tags" filter="visibility:public+slug:-{{slug}}" include="count.posts" order="count.posts desc" limit="6" as |other_tags|}}{{#if other_tags}} +
      + {{#foreach other_tags}}{{#match count.posts ">" 0}} +
    • {{name}}
    • + {{/match}}{{/foreach}} +
    + {{/if}}{{/get}} +
    + {{/tag}} + {{> "archive-list"}} +
    diff --git a/tools/build-ghost-zip.sh b/tools/build-ghost-zip.sh new file mode 100755 index 0000000..c3cbc54 --- /dev/null +++ b/tools/build-ghost-zip.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Builds the distributable Ghost theme zip: the contents of ghost/ inside a +# top-level readerly/ folder, ready for Ghost Admin > Settings > Design > Change theme > Upload theme. +# +# tools/build-ghost-zip.sh writes dist/readerly-ghost-.zip and prints its path +# +# Only files below ghost/ go in; the design reference, tools and harness never +# ship. Dotfiles, node_modules and editor and OS leftovers are excluded. +set -euo pipefail + +repo="$(cd "$(dirname "$0")/.." && pwd)" +theme="$repo/ghost" +version="$(sed -n 's/^[[:space:]]*"version":[[:space:]]*"\([^"]*\)".*/\1/p' "$theme/package.json" | head -n1)" +[[ -n "$version" ]] || { echo "no version in ghost/package.json" >&2; exit 1; } + +for required in package.json default.hbs index.hbs post.hbs; do + [[ -f "$theme/$required" ]] || { echo "missing ghost/$required" >&2; exit 1; } +done + +out="$repo/dist/readerly-ghost-$version.zip" +stage="$(mktemp -d)" +trap 'rm -rf "$stage"' EXIT + +mkdir -p "$repo/dist" "$stage/readerly" +cp -R "$theme/." "$stage/readerly/" +find "$stage/readerly" -depth \( -name '.*' -o -name node_modules -o -name 'Thumbs.db' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -o -name '*.log' -o -name '*.map' \) -exec rm -rf {} + + +rm -f "$out" +# -X drops extra file attributes and -D skips directory entries, so the zip holds only files. +(cd "$stage" && find readerly -type f | LC_ALL=C sort | zip -qXD "$out" -@) +echo "$out" diff --git a/tools/build-tokens.mjs b/tools/build-tokens.mjs index 80292a6..fd2d3b2 100644 --- a/tools/build-tokens.mjs +++ b/tools/build-tokens.mjs @@ -289,6 +289,23 @@ const outputs = [ ...mirrors.flatMap((m) => m.copies), ]; +// The Ghost theme (ghost/) ships the same stylesheet and script as Jekyll, plus +// its own ghost.css for Koenig cards and members forms, which is not generated. +const ghostMirrors = [ + mirror('design/assets/fonts', 'ghost/assets/fonts'), + mirror('design/assets/img', 'ghost/assets/img', ['paper-grain.svg', 'cover-grain.svg']), +]; +mirrors.push(...ghostMirrors); +outputs.push( + ['ghost/assets/css/readerly.css', () => { + const css = buildJekyllCss(); + if (!css.startsWith('/* Readerly for Jekyll.')) throw new Error('buildJekyllCss() banner changed: update the Ghost banner swap'); + return css.replace('Readerly for Jekyll.', 'Readerly for Ghost.'); + }], + ['ghost/assets/js/theme.js', () => readFileSync(join(root, 'design/assets/js/theme.js'))], + ...ghostMirrors.flatMap((m) => m.copies), +); + const check = process.argv.includes('--check'); const stale = []; for (const [path, build] of outputs) { diff --git a/tools/ghost-dev/check.mjs b/tools/ghost-dev/check.mjs new file mode 100644 index 0000000..79f61ef --- /dev/null +++ b/tools/ghost-dev/check.mjs @@ -0,0 +1,86 @@ +// Every check against a running, seeded Ghost with the Readerly theme. Exits 1 when any fails. +// node check.mjs [out dir] +// 1. Markup parity with the seven design pages (same algorithm as tools/jekyll-dev/check-parity.mjs). +// 2. check-pages.cjs on pages.json at 1280 and 390 px, in Paper and Lamplight. +// 3. Side-by-side screenshots of the design and Ghost (side-by-side.mjs). +import { readFileSync, mkdirSync } from 'node:fs'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { spawn } from 'node:child_process'; +import { parse } from 'node-html-parser'; +import { body, compare } from '../jekyll-dev/check-parity.mjs'; + +const here = dirname(fileURLToPath(import.meta.url)); +const repo = join(here, '../..'); +const site = (process.argv[2] ?? '').replace(/\/$/, ''); +const out = process.argv[3] ?? join(here, 'out'); +if (!site) { + console.error('usage: node check.mjs [out dir]'); + process.exit(2); +} + +export const GHOST_PAGES = { + 'index.html': '/', + 'review.html': '/the-salt-orchard/', + 'author.html': '/isobel-thorne/', + 'reading-log.html': '/reading-log/', + 'archive.html': '/tag/literary-fiction/', + 'page.html': '/about/', + '404.html': '/readerly-missing-page/', +}; + +const exceptions = JSON.parse(readFileSync(join(here, 'parity-exceptions.json'), 'utf8')); +const results = []; + +function report(name, failures) { + results.push({ name, failures }); + console.log(`${failures.length ? 'FAIL' : 'ok '} ${name}${failures.length ? `\n ${failures.slice(0, 40).join('\n ')}` : ''}`); +} + +function run(args) { + return new Promise((done) => { + const child = spawn(process.execPath, args, { stdio: ['ignore', 'pipe', 'pipe'] }); + let output = ''; + child.stdout.on('data', (d) => (output += d)); + child.stderr.on('data', (d) => (output += d)); + child.on('close', (status) => done({ status, output })); + }); +} + +async function parity() { + const failures = []; + for (const [file, path] of Object.entries(GHOST_PAGES)) { + const response = await fetch(site + path); + const expected = file === '404.html' ? 404 : 200; + if (response.status !== expected) failures.push(`${file}: ${path} answered ${response.status}, expected ${expected}`); + // Ghost adds a class per page, tag and author to body; the design's body has none. + const siteHtml = (await response.text()).replace(/]*>/, ''); + const designHtml = readFileSync(join(repo, 'design', file), 'utf8'); + const problems = []; + compare(body(designHtml, file, 'design', exceptions), body(siteHtml, file, 'demo', exceptions), '', problems); + failures.push(...problems.slice(0, 8).map((p) => `${file}${p}`)); + } + return failures; +} + +mkdirSync(out, { recursive: true }); +report('markup parity with the seven design pages', await parity()); + +const mapFile = join(here, 'pages.json'); +const pageCount = Object.keys(JSON.parse(readFileSync(mapFile, 'utf8')).pages).length; +const browserFailures = []; +for (const label of ['paper', 'lamplight']) { + const shots = join(out, 'shots'); + mkdirSync(shots, { recursive: true }); + const result = await run([join(repo, 'tools/wp-dev/check-pages.cjs'), site, shots, label, mapFile]); + if (result.status !== 0) browserFailures.push(...result.output.trim().split('\n')); +} +report(`browser checks on ${pageCount} pages, 1280 and 390 px, Paper and Lamplight`, browserFailures); + +const sideBySide = await run([join(here, 'side-by-side.mjs'), site, out]); +report('side-by-side screenshots written', sideBySide.status === 0 ? [] : sideBySide.output.trim().split('\n').slice(-5)); +if (sideBySide.status === 0) console.log(` ${sideBySide.output.trim().split('\n').pop()}`); + +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/ghost-dev/export-static.mjs b/tools/ghost-dev/export-static.mjs new file mode 100644 index 0000000..a4bb3c2 --- /dev/null +++ b/tools/ghost-dev/export-static.mjs @@ -0,0 +1,239 @@ +// Crawls a running Ghost into a static copy for Cloudflare Pages, then loads the copy in a +// browser to prove it stands alone. +// +// node export-static.mjs +// +// What the copy changes from what Ghost serves: +// - the Ghost origin becomes the public URL everywhere (links, canonical, JSON-LD, feeds, sitemaps) +// - Portal, comments and member-attribution scripts and the comments section are removed; they need Ghost's members API +// - every form[data-members-form] becomes data-demo-form, which the theme script confirms in place +// - the three search-index responses sodo-search reads are saved as files, so search works +// - _headers allows framing by ghost.org (the Marketplace preview) and types the feed and the search files +// - _redirects lists the redirects Ghost answered while crawling +import { mkdirSync, readFileSync, writeFileSync, existsSync, statSync, rmSync, readdirSync } from 'node:fs'; +import { dirname, extname, join, normalize } from 'node:path'; + +const [source, out, publicUrl] = process.argv.slice(2); +if (!source || !out || !publicUrl) { + console.error('usage: node export-static.mjs '); + process.exit(2); +} +const origin = new URL(source).origin; +const publicOrigin = new URL(publicUrl).origin; +const publicHost = new URL(publicUrl).host; +const sourceHost = new URL(source).host; +const SKIPPED = /^\/(ghost|members|r|webmentions)(\/|$)/; +const TEXT = /^(text\/|application\/(json|xml|rss\+xml|atom\+xml|javascript|xslt\+xml)|image\/svg)/; +const PROBE_404 = '/readerly-404-probe/'; + +const enc = encodeURIComponent; +function rewrite(text) { + return text + .replaceAll(origin, publicOrigin) + .replaceAll(`//${sourceHost}`, `//${publicHost}`) + .replaceAll(enc(origin), enc(publicOrigin)) + .replaceAll(origin.replaceAll('/', '\\/'), publicOrigin.replaceAll('/', '\\/')); +} + +function clean(html) { + return html + .replace(/]*\bsrc="[^"]*(?:portal|comments-ui|comment-counts|member-attribution|ghost-stats|tinybird)[^"]*"[^>]*><\/script>\s*/gi, '') + .replace(/]*\bclass="[^"]*\bcomments\b[^"]*"[^>]*>[\s\S]*?<\/section>\s*/gi, '') + .replace(/]*webmention[^>]*>\s*/gi, '') + .replace(/(]*?)\sdata-members-form(?:="[^"]*")?/gi, '$1 data-demo-form'); +} + +const pages = new Map(); +const redirects = new Map(); +const queue = []; +const seen = new Set(); +const bodies = new Map(); +const strict = new Set(); +const aliases = new Map(); +const skipped = []; + +function enqueue(url, required = false) { + const parsed = new URL(url, origin); + if (parsed.origin !== origin || SKIPPED.test(parsed.pathname)) return; + if (required) strict.add(parsed.pathname); + if (!seen.has(parsed.pathname)) { + seen.add(parsed.pathname); + queue.push(parsed.pathname); + } +} + +function refs(text, base) { + const found = new Set(); + for (const m of text.matchAll(/\b(?:href|src|poster|data-src|data-sodo-search|data-api)=["']([^"']+)["']/g)) found.add(m[1]); + for (const m of text.matchAll(/\b(?:srcset|data-srcset)=["']([^"']+)["']/g)) for (const part of m[1].split(',')) found.add(part.trim().split(/\s+/)[0]); + for (const m of text.matchAll(/url\(\s*["']?([^)"']+)/g)) found.add(m[1]); + const locs = [...text.matchAll(/([^<]+)<\/loc>/g)].map((m) => m[1]); + for (const loc of locs) enqueue(loc, true); + for (const m of text.matchAll(/]+rel="(?:next|prev)"[^>]*href="([^"]+)"/g)) found.add(m[1]); + for (const m of text.matchAll(new RegExp(`${origin.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/[^"'\\s<>)\\\\]+`, 'g'))) found.add(m[0]); + for (const ref of found) { + if (/^(#|mailto:|tel:|data:|javascript:)/i.test(ref) || /\{|%7b|%url%/i.test(ref)) continue; + try { + enqueue(new URL(ref, base).href); + } catch {} + } +} + +function fileFor(pathname) { + if (pathname.endsWith('/')) return `${pathname}index.html`; + return extname(pathname) ? pathname : `${pathname}/index.html`; +} + +async function fetchOne(pathname) { + const response = await fetch(origin + pathname, { redirect: 'manual' }); + if (response.status >= 300 && response.status < 400) { + const target = new URL(response.headers.get('location'), origin); + if (target.origin !== origin) return; + // A file that Ghost redirects (a sized copy of an SVG) is stored under both paths, so no + // host has to apply a redirect rule for an asset. A page redirect goes into _redirects. + if (extname(pathname)) aliases.set(pathname, target.pathname); + else redirects.set(pathname, target.pathname); + enqueue(target.href); + return; + } + if (pathname === PROBE_404) { + if (response.status !== 404) throw new Error(`${PROBE_404} answered ${response.status}, expected 404`); + store('/404.html', 'text/html', Buffer.from(await response.arrayBuffer()), pathname); + return; + } + if (!response.ok) { + if (strict.has(pathname)) throw new Error(`${pathname} answered ${response.status}`); + skipped.push(`${pathname} (${response.status})`); + return; + } + store(fileFor(pathname), response.headers.get('content-type') ?? '', Buffer.from(await response.arrayBuffer()), pathname); +} + +function store(file, type, buffer, pathname) { + if (TEXT.test(type)) { + let text = buffer.toString('utf8'); + refs(text, origin + pathname); + text = rewrite(text); + if (/^text\/html/.test(type)) text = clean(text); + bodies.set(file, Buffer.from(text)); + } else bodies.set(file, buffer); +} + +async function crawl() { + for (const path of ['/', '/robots.txt', '/sitemap.xml', '/rss/', PROBE_404]) enqueue(origin + path, true); + let key = null; + while (queue.length) { + const batch = queue.splice(0, 8); + await Promise.all(batch.map(fetchOne)); + } + for (const [file, body] of bodies) { + const m = body.toString('latin1').match(/data-key="([0-9a-f]{26})"/); + if (m && file.endsWith('.html')) key = key ?? m[1]; + } + return key; +} + +async function searchIndex(key) { + if (!key) return false; + for (const name of ['posts', 'authors', 'tags']) { + const response = await fetch(`${origin}/ghost/api/content/search-index/${name}/?key=${key}`); + if (!response.ok) throw new Error(`search index ${name} answered ${response.status}`); + bodies.set(`/ghost/api/content/search-index/${name}/index.html`, Buffer.from(rewrite(await response.text()))); + } + return true; +} + +const headers = `/* + Content-Security-Policy: frame-ancestors 'self' https://*.ghost.org + X-Content-Type-Options: nosniff + Referrer-Policy: strict-origin-when-cross-origin + +/rss/ + Content-Type: application/rss+xml; charset=utf-8 + +/ghost/api/content/search-index/* + Content-Type: application/json; charset=utf-8 + Access-Control-Allow-Origin: * +`; + +function write() { + rmSync(out, { recursive: true, force: true }); + for (const [file, body] of bodies) { + const target = join(out, file); + mkdirSync(dirname(target), { recursive: true }); + writeFileSync(target, body); + } + writeFileSync(join(out, '_headers'), headers); + if (redirects.size) writeFileSync(join(out, '_redirects'), [...redirects].map(([from, to]) => `${from} ${to} 301`).join('\n') + '\n'); +} + +// Serves the copy the way Cloudflare Pages does: directory URLs get index.html, a miss gets 404.html. +function lookup(pathname) { + const root = normalize(out); + const path = decodeURIComponent(pathname); + let file = join(root, path); + if (existsSync(file) && statSync(file).isDirectory()) file = join(file, 'index.html'); + if (existsSync(file) && statSync(file).isFile()) { + const type = path === '/rss/' ? 'application/rss+xml' : path.startsWith('/ghost/api/') ? 'application/json' : { '.html': 'text/html', '.css': 'text/css', '.js': 'text/javascript', '.svg': 'image/svg+xml', '.xml': 'application/xml', '.txt': 'text/plain', '.woff2': 'font/woff2', '.json': 'application/json', '.xsl': 'text/xsl' }[extname(file)] ?? 'application/octet-stream'; + return { status: 200, type, body: readFileSync(file) }; + } + const missing = join(root, '404.html'); + return { status: 404, type: 'text/html', body: existsSync(missing) ? readFileSync(missing) : Buffer.from('Not found') }; +} + +async function verify() { + const { chromium } = await import('playwright-core'); + const files = readdirSync(out, { recursive: true }).filter((f) => f.endsWith('.html')).sort(); + const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH || undefined }); + const context = await browser.newContext({ viewport: { width: 1280, height: 900 } }); + const problems = []; + let current = ''; + await context.route('**/*', async (route) => { + const url = new URL(route.request().url()); + if (url.origin === publicOrigin) { + const { status, type, body } = lookup(url.pathname); + if (status === 404 && url.pathname !== PROBE_404 && !current.endsWith('404.html') && route.request().resourceType() !== 'document') problems.push(`${current}: ${url.pathname} is not in the copy`); + return route.fulfill({ status, contentType: type, body }); + } + if (url.origin === origin) problems.push(`${current}: request to the Ghost origin ${url.href}`); + else if (!/^https:\/\/cdn\.jsdelivr\.net\/ghost\//.test(url.href) && url.protocol !== 'data:') problems.push(`${current}: third-party request ${url.href}`); + return route.continue(); + }); + const page = await context.newPage(); + page.on('requestfailed', (r) => problems.push(`${current}: failed ${r.url()} (${r.failure()?.errorText})`)); + page.on('pageerror', (e) => problems.push(`${current}: page error ${e.message}`)); + page.on('console', (m) => { + if (m.type() === 'error' && !/status of 404/.test(m.text())) problems.push(`${current}: console ${m.text()}`); + }); + for (const file of files) { + const path = `/${file}`.replace(/index\.html$/, ''); + current = file; + const response = await page.goto(publicOrigin + path, { waitUntil: 'networkidle' }); + const expected = file === '404.html' ? 404 : 200; + if (file !== '404.html' && response.status() !== expected) problems.push(`${file}: HTTP ${response.status()}`); + } + current = 'search'; + await page.goto(`${publicOrigin}/#/search`, { waitUntil: 'networkidle' }); + const frame = page.frameLocator('iframe[title="Search"], iframe[srcdoc], .gh-search iframe, iframe').first(); + const input = frame.locator('input').first(); + try { + await input.waitFor({ timeout: 10000 }); + await input.fill('Salt'); + await frame.getByText(/Salt Orchard/).first().waitFor({ timeout: 10000 }); + } catch (error) { + problems.push(`search did not open and find "Salt": ${error.message.split('\n')[0]}`); + } + await browser.close(); + return { files, problems }; +} + +const key = await crawl(); +for (const [from, to] of aliases) if (bodies.has(to)) bodies.set(from, bodies.get(to)); +const search = await searchIndex(key); +write(); +console.log(`Exported ${[...bodies.keys()].filter((f) => f.endsWith('.html')).length} pages and ${bodies.size} files to ${out}${search ? ', with the sodo-search index' : ', without a search index (the site exposes no key)'}`); +if (skipped.length) console.log(`not saved, Ghost answered an error: ${skipped.join(', ')}`); +if (redirects.size) console.log(`redirects: ${[...redirects].map(([a, b]) => `${a} -> ${b}`).join(', ')}`); +const { files, problems } = await verify(); +console.log(problems.length ? `FAIL\n${[...new Set(problems)].slice(0, 40).join('\n')}` : `Static copy verified: ${files.length} pages load with no Ghost-origin or failed requests, and search finds "Salt".`); +process.exit(problems.length ? 1 : 0); diff --git a/tools/ghost-dev/ghost-dev.sh b/tools/ghost-dev/ghost-dev.sh new file mode 100755 index 0000000..4b29023 --- /dev/null +++ b/tools/ghost-dev/ghost-dev.sh @@ -0,0 +1,190 @@ +#!/usr/bin/env bash +# Local Ghost for developing and checking the Readerly Ghost theme. Needs Docker and Node 20+. +# +# tools/ghost-dev/ghost-dev.sh up start Ghost 6 with ghost/ mounted as theme readerly, create the admin, activate the theme, load the demo +# tools/ghost-dev/ghost-dev.sh seed reload the Marginalia demo content (deletes every post, page and tag first) +# tools/ghost-dev/ghost-dev.sh gscan [path] [-z] run GScan for Ghost 6 on a theme folder (default ghost/) or, with -z, a zip; exit 1 on any error or warning +# tools/ghost-dev/ghost-dev.sh check markup parity with design/, browser checks and side-by-side screenshots, against the running site +# tools/ghost-dev/ghost-dev.sh export [public url] crawl the running site into a static copy for Cloudflare Pages, then verify it +# tools/ghost-dev/ghost-dev.sh url print the site URL +# tools/ghost-dev/ghost-dev.sh down stop Ghost (keeps the database and uploaded images) +# tools/ghost-dev/ghost-dev.sh clean remove the container, its volume and the remembered port +# +# Every command is safe to rerun. Ghost listens on 127.0.0.1 at PORT, or at the first +# free port from 2380, remembered in tools/ghost-dev/.state. The admin is +# admin@readerly.test with the password in seed.mjs (printed by up). +# +# Environment: +# PORT fixed port +# THEME_DIR theme folder to mount (default ghost/); without package.json the default theme stays active +# GHOST_NETWORK a Docker network. Ghost joins it as host "ghost" and publishes no port; seed, +# check and export then run in a Playwright container on that network. CI uses +# this, because a job container cannot reach the host's published ports. +set -euo pipefail + +here="$(cd "$(dirname "$0")" && pwd)" +repo="$(cd "$here/../.." && pwd)" +state="$here/.state" +name=readerly-ghost-dev +volume="$name-content" +ghost_image=ghost:6 +runner_image=mcr.microsoft.com/playwright:v1.61.0-noble +theme_dir="$(realpath -m "${THEME_DIR:-$repo/ghost}")" +network="${GHOST_NETWORK:-}" + +port_in_use() { ss -Hltn "sport = :$1" | grep -q .; } +running() { [[ "$(docker inspect -f '{{.State.Running}}' "$name" 2>/dev/null || true)" == true ]]; } + +pick_port() { + if [[ -n "${PORT:-}" ]]; then echo "$PORT"; return; fi + if running; then docker port "$name" 2368/tcp | head -n1 | sed 's/.*://'; return; fi + if [[ -f "$state" ]]; then + local saved + saved="$(sed -n 's/^PORT=//p' "$state")" + if [[ -n "$saved" ]] && ! port_in_use "$saved"; then echo "$saved"; return; fi + fi + for p in $(seq 2380 2499); do + if ! port_in_use "$p"; then echo "$p"; return; fi + done + echo "no free port in 2380-2499" >&2 + exit 1 +} + +if [[ -n "$network" ]]; then + url="http://ghost:2368" +else + port="$(pick_port)" + url="http://localhost:$port" +fi + +ghost_ready() { + if [[ -n "$network" ]]; then + docker exec "$name" node -e 'fetch("http://localhost:2368/ghost/api/admin/site/").then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))' + else + curl -fsS -o /dev/null "$url/ghost/api/admin/site/" + fi +} + +start() { + if running; then + ghost_ready 2>/dev/null && return + fi + docker rm -f "$name" >/dev/null 2>&1 || true + local args=( + -e "url=$url" -e NODE_ENV=development -e security__staffDeviceVerification=false + -e privacy__useUpdateCheck=false -e privacy__useGravatar=false -e privacy__useRpcPing=false + -v "$volume:/var/lib/ghost/content" + ) + if [[ -n "$network" ]]; then + args+=(--network "$network" --network-alias ghost) + else + args+=(-p "127.0.0.1:$port:2368") + [[ -f "$theme_dir/package.json" ]] && args+=(-v "$theme_dir:/var/lib/ghost/content/themes/readerly:ro") + printf 'PORT=%s\n' "$port" >"$state" + fi + local cid + cid="$(docker create --name "$name" "${args[@]}" "$ghost_image")" + # A job container cannot bind-mount its own files, so the theme is copied in instead. + if [[ -n "$network" && -f "$theme_dir/package.json" ]]; then + # The image has no content folder until Ghost first starts, so make the theme folder in the volume. + docker run --rm -v "$volume:/var/lib/ghost/content" --entrypoint mkdir "$ghost_image" -p /var/lib/ghost/content/themes/readerly + docker cp "$theme_dir/." "$cid:/var/lib/ghost/content/themes/readerly" + fi + docker start "$cid" >/dev/null + local tries=0 + until ghost_ready 2>/dev/null; do + if (( ++tries > 180 )); then + echo "Ghost did not answer within 180 seconds. Check: docker logs $name" >&2 + exit 1 + fi + sleep 1 + done +} + +# node_tool