A CLI for publishing standard.site documents to ATProto sequoia.pub

sequoia inject breaks on Hugo page bundles #50

Open kylestratis.com
Open opened by kylestratis.com

Environment: sequoia-cli 0.5.7 · Hugo 0.147.8 (extended) · macOS · posts as page bundles (content/posts//index.md), some with custom slug frontmatter

sequoia inject does not match built HTML files to their corresponding documents. Instead of injecting a per-page site.standard.document link (and skipping pages with no document), it applies a single document's URI to every HTML file in the output directory, including pages that have no document (home, section lists, tag/category pages).

Steps to reproduce:

  1. Hugo site with posts as page bundles (shouldn't affect it, but I am using the terminal theme); publish with sequoia publish (creates one site.standard.document per post).
  2. hugo to build into ./public.
  3. sequoia inject --dry-run.

Expected: each post's HTML gets a matching that post; pages without a document get nothing.

Actual: all 158 HTML files on the built kylestratis.com site (25 posts + ~133 list/taxonomy/home pages) receive the same URI belonging to a single post (on-imposter-syndrome). Posts without a custom slug are mismapped too (e.g. a-better-practices-guide-to-using-claude-code, whose dir matches its URL, got the wrong document), so this is not limited to custom slugs.

Likely cause: sequoia stores slugs with a trailing /index for page bundles (e.g. hash-slices-perl/index) which never matches the built path /posts//index.html; when matching fails it falls back to a single default document rather than skipping.

Workaround: emit the from each post's atUri frontmatter in the template instead:

{{ with .Params.atUri }}
  <link rel="site.standard.document" href="{{ . | safeURL }}">

Are you saying that sequoia is injecting the same atUri into every static file? Did you run sequoia init to configure your source and static file paths, and set a pathTemplate if necessary? See https://sequoia.pub/config.

Otherwise, some simple examples of what your source path and front matter look like, as well as where your generated files end up and what they are looking like. I'm not quite understanding the issue.

I did some more investigation, and the sequoia inject command is injecting the same site.standard.document/3mnftlnwnc32h link (for verification, I believe) into every single built HTML file, regardless of whether there's an atUri associated with the file.

I believe this means that the slug->file (?) matching logic is broken for this case, specifically here (I'm not a big TS/JS person, so forgive any errors):

// each hugo page bundle is in the form <name>/index
const lastSegment = postState.slug.split("/").pop();   // "<name>/index" becomes "index", which is non-unique
if (lastSegment !== postState.slug)
  slugToAtUri.set(lastSegment, postState.atUri);        // EVERY page-bundle post sets key "index"; last wins
...
atUri = slugToAtUri.get(htmlBasename);                  // every index.html does get("index") → that one post that won

Knowing to set removeIndexFromSlug to true on first run would avoid this exact collision, but not every case of a non-unique identifier final segment, resulting in the same link being applied to every single HTML file, rather than a failure or warning.

Sign up or Sign in to add to the discussion.