Skip to content

fix(cli): #1715 split active content keys on first hyphen so hyphenated collections resolve#1716

Open
jstockdi wants to merge 1 commit into
ProjectEvergreen:masterfrom
Battle-Creek-LLC:bug/issue-1715-collection-name-hyphen
Open

fix(cli): #1715 split active content keys on first hyphen so hyphenated collections resolve#1716
jstockdi wants to merge 1 commit into
ProjectEvergreen:masterfrom
Battle-Creek-LLC:bug/issue-1715-collection-name-hyphen

Conversation

@jstockdi

Copy link
Copy Markdown
Contributor

Related Issue

Resolves #1715

Documentation

N/A — no user-facing documentation changes (bug fix only; the collection-<name> /
route-<route> content key format is unchanged).

Summary of Changes

  1. Split active content content keys on only the first hyphen so the value keeps any
    remaining hyphens, in packages/cli/src/plugins/resource/plugin-active-content.js
    (server /___graph.json handler) and packages/cli/src/data/client.js (client-side
    getContentByCollection / getContentByRoute when not prerendering).
  2. Hyphenated collection names (e.g. my-posts) now resolve to their pages instead of [];
    hyphenated routes (e.g. /my-blog) keep their full value instead of being truncated to a
    prefix that over-matches.
  3. Behavior for hyphen-free keys (graph, collection-nav, route-/blog) is unchanged.
  4. Added regression test
    packages/cli/test/cases/develop.config.active-content-collection-hyphen/ that serves a
    collection named my-posts across two pages and asserts
    X-CONTENT-KEY: collection-my-posts returns those pages (fails with [] on unpatched source).
  5. No breaking changes.

@jstockdi jstockdi self-assigned this Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getContentByCollection returns empty for hyphenated collection names

1 participant