Skip to content

v0.41.0

Choose a tag to compare

@henshaw henshaw released this 15 Nov 18:31
· 23 commits to main since this release
b112813

Coywolf Pack is an EmDash plugin that enhances existing features and adds features not available in EmDash. It helps you manage your site like a pro and ensure it's absurdly fast for humans and bots.

  • Absurdly fast for humans and bots: cached pages answer in 60–90 ms, cache warming keeps pages cached for visitors and crawlers alike, and images come straight from Cloudflare's edge.
  • Enhances what EmDash already does: redirects, search, robots.txt, schema, images and RSS feeds go well beyond EmDash's built-in versions and starter templates.
  • Adds what EmDash doesn't have: backups and restore, link checking, videos, reviews, AI enrichment and more.
  • Manage your site like a pro: turn each feature on or off, see your Cloudflare usage and estimated bill, and finish a move from WordPress. Everything starts off, so installing or updating changes nothing until you're ready.
  • Free and open source (MIT).

What's new in 0.41.0

Pagination (new, off by default)

Numbered page links for your theme's archives (home page, categories, tags, authors and search), following the W3C design system's pagination pattern: Previous, the first page, the pages around the current one, the last page, and Next.

  • One line at every width. On a phone it shows ‹ 1 … 12 … 23 ›; wider screens add the neighboring pages, and Previous and Next become words. It never wraps to a second line, and on a 320px phone every link is still a 44×44 target. It works without JavaScript, and browsers without container queries get the phone layout.
  • Accessible. The navigation is labeled and the current page is marked for screen readers. Links read "Page 3", "Previous page" and "Next page". Gaps aren't announced, and the current page is bold with a border, which also works in Windows high-contrast mode.
  • A real last page. The pack counts the posts in an archive, following EmDash's own rules for what's published. Search and author archives show no last-page link.
  • Themes style it with --cw-pagination-* custom properties.

Add it to a theme with <Pagination>, archivePage() and countEntries() from @coywolf/emdash/astro. The steps and route code are in Pagination.

Short page URLs (new, off by default, separate from Pagination)

Page 3 of the home page becomes /3/ and page 2 of a category /news/web-development/2/, instead of /page/3/. Old /page/N/ addresses redirect in one hop, with the query string kept. Each page's canonical link points to itself.

  • Its own switch. Hiding the numbered links doesn't change your page addresses, and turning Short page URLs off sends /N/ back to /page/N/, so no page 404s.
  • Safe to switch. Redirects tell browsers not to cache them, so a later switch change can't trap a visitor in a redirect loop.
  • Before turning it on, delete any redirect rules that send /page/N/ addresses elsewhere (WordPress imports often have them). Stored redirects run first.
  • Archives with a prefix, like /tag/ and /author/, can be listed in pagination: { bases: { "/tag/": 1, "/author/": 1 } }, so a tag named "page" still pages correctly.

robots.txt updates sooner

  • Saving SEO settings clears the cached /robots.txt even when Robots.txt Rules is off. Before, EmDash's file could stay cached for up to a day.
  • Saving robots.txt rules shows the new file right away. The pack no longer keeps a short-lived copy of the rules in each server instance, which could put the old file back in the cache.
  • Changing the Site URL clears /robots.txt, since both robots.txt files name the sitemap at the Site URL.

Install

Coywolf Pack is a native (trusted) EmDash plugin: you add it to your site's code and deploy, rather than installing it from EmDash's plugin directory. These steps use coywolf.com as the example; change the names to your site's. The full guide, with troubleshooting, is Getting started in the README.

What you need: an EmDash site (1.5 or later) on Cloudflare Workers, using EmDash's Cloudflare adapter with a D1 database bound as DB and an R2 media bucket bound as MEDIA, and its code in a folder you can edit and deploy.

1. Install the package

From the site's folder:

npm install @coywolf/emdash

2. Add the plugin to astro.config.mjs

// astro.config.mjs
import { coywolfPlugin } from "@coywolf/emdash";

export default defineConfig({
  // ...
  integrations: [
    emdash({
      // ...your existing database and storage settings
      plugins: [
        coywolfPlugin({
          // Backups is the one module that's added only when you give it a name (it names the backup files).
          backups: { name: "coywolf" },
        }),
      ],
    }),
  ],
});

coywolfPlugin() with no options works too: every module except Backups is included with its defaults. Set a module to false (for example videos: false) to leave it out.

3. Add the middleware

Redirects, /robots.txt rules, the RSS feed, llms.txt, file downloads, video and news sitemaps, image sizes and cache warming answer their own URLs, so they need the pack's middleware, first in src/middleware.ts:

// src/middleware.ts
import { sequence } from "astro:middleware";
import { coywolfPack } from "@coywolf/emdash/middleware";

export const onRequest = sequence(coywolfPack() /* , your own middleware */);

4. Check wrangler.jsonc

DB and MEDIA are all the pack needs to start. Add the others when you turn on the features that use them:

// wrangler.jsonc (coywolf.com)
{
  "name": "coywolf",
  "d1_databases": [{ "binding": "DB", "database_name": "coywolf", "database_id": "<D1 database id>" }],
  "r2_buckets": [
    { "binding": "MEDIA", "bucket_name": "coywolf-media" },
    // Backups: a second bucket for backup files.
    { "binding": "BACKUPS", "bucket_name": "coywolf-backups" }
  ],
  // Page cache: Workers Cache in front of the Worker, and the deployed version so old pages are cleared after a deploy.
  "cache": { "enabled": true },
  "version_metadata": { "binding": "CF_VERSION_METADATA" },
  // Cache warming and checking internal links: the Worker calling itself.
  "services": [{ "binding": "SELF", "service": "coywolf" }]
}

API keys and tokens (Keys) are stored encrypted, so the site also needs EmDash's EMDASH_ENCRYPTION_KEY secret (npx wrangler secret put EMDASH_ENCRYPTION_KEY if setup didn't create it). Keep it in a password manager.

5. Deploy

Deploy as you usually do. Nothing changes for visitors yet: every feature starts off.

6. Turn features on

  1. Sign in to the admin (https://coywolf.com/_emdash/admin).
  2. Open Plugins → Coywolf Pack → Features and turn on the modules you want. Turn on Update check, the first switch, to get a card on the dashboard when a new version is out.
  3. Open each module's page in the Coywolf Pack section of the sidebar for its settings and step-by-step guides.

Updating from an earlier version

npm install @coywolf/emdash@latest

Then deploy. If your package.json points at a GitHub tarball URL from an earlier release, this command replaces it with the npm version. Updates never turn features on by themselves.

Update notices: turn on Update check, the first switch under Plugins → Coywolf Pack → Features. Once a day it asks npm for the newest version of Coywolf Pack. When there's an update, a Coywolf Pack update card on the EmDash dashboard and a notice at the top of the pack's pages show the command above, with a Copy command button. Dismiss hides both for everyone on the site until the next version. The check sends nothing about your site and never updates anything by itself.