Skip to content

Use names for Pages CMS collections#1475

Merged
stefan-burke merged 3 commits into
mainfrom
feature/pages-yml-name
Jul 14, 2026
Merged

Use names for Pages CMS collections#1475
stefan-burke merged 3 commits into
mainfrom
feature/pages-yml-name

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • generate collection filenames from required name fields and display reference labels from {fields.name}
  • verify every reference target exists, requires name, and has named content while fixing snippet and stale location references
  • prevent precommit child processes from inheriting linked-worktree Git state

Testing

  • bun run precommit
  • bun test test/unit/precommit.test.js test/unit/code-quality/pages-yml-reference-names.test.js test/unit/scripts/customise-cms/generator.test.js

Summary by CodeRabbit

  • Improvements
    • CMS reference fields now search and display using the referenced content’s “name”.
    • Generated page/collection filenames now consistently use {name} and all supported collections require a name field.
    • Product/category/news/team/reviews/properties/guide/menu references are validated end-to-end.
    • Properties “Locations” are now an editable string list.
    • Snippets exclude README.md, and snippet markdown now includes standardized front-matter (including new footer/right-content names).
  • Bug Fixes
    • Precommit step environments are now sanitized to avoid local Git state.
  • Tests
    • Added/expanded unit coverage for reference conversion, YAML consistency, environment behavior, and snippet filter resolution.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 94bd404b-5714-485f-9894-924a4953cf86

📥 Commits

Reviewing files that changed from the base of the PR and between 5bf4890 and 94623ae.

📒 Files selected for processing (2)
  • src/_lib/eleventy/file-utils.js
  • test/unit/utils/file-utils.test.js

📝 Walkthrough

Walkthrough

Changes

CMS collection schemas and generated Pages CMS definitions now require name, use name-based references and filenames, represent property locations as editable string lists, and exclude snippet README files. Snippet path loading and validation were updated. Precommit child environments now filter local Git variables and set VERBOSE.

CMS configuration

Layer / File(s) Summary
Schema and reference contracts
scripts/customise-cms/fields.js, scripts/customise-cms/blocks.js, scripts/customise-cms/field-builders.js, scripts/customise-cms/item-builders.js, scripts/customise-cms/config.js
CMS fields and references require names, use fields.name, omit the locations collection, and represent property locations as editable string lists.
Collection filename generation
scripts/customise-cms/collection-config.js, scripts/customise-cms/generator.js
Generated collection filenames use {name}, date-based collections retain date prefixes, and snippets exclude README.md.
Pages CMS definitions
.pages.yml, src/snippets/*.md
Collections use required names, name-based filenames and references, updated property locations, snippet exclusions, and snippet frontmatter names.
Snippet path normalization
src/_lib/eleventy/file-utils.js, test/unit/utils/file-utils.test.js
Snippet loading normalizes CMS-style paths before resolving markdown files, with coverage for snippet block loading.
CMS configuration validation
test/unit/scripts/customise-cms/*, test/unit/utils/pages-yml-helpers.js, test/unit/code-quality/pages-yml-reference-names.test.js
Tests validate generated names, filenames, references, exclusions, editable locations, block conversion, and referenced entry frontmatter.

Precommit environment filtering

Layer / File(s) Summary
Precommit child environment
test/precommit/environment.js, test/precommit/runner.js, test/unit/precommit.test.js
Precommit steps use a filtered environment that removes local Git variables and sets VERBOSE explicitly, with corresponding tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: Pages CMS collections now rely on names for filenames and references.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/pages-yml-name

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/customise-cms/fields.js`:
- Around line 199-201: Update the reference field configuration containing value
"{path}" and label "{fields.name}" so its search property is an array containing
the fields.name reference, rather than a string. Preserve the existing value and
label settings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d140f1e9-5e84-4506-8414-75ed24542d15

📥 Commits

Reviewing files that changed from the base of the PR and between b7499fc and 6124e12.

📒 Files selected for processing (18)
  • .pages.yml
  • scripts/customise-cms/blocks.js
  • scripts/customise-cms/collection-config.js
  • scripts/customise-cms/config.js
  • scripts/customise-cms/field-builders.js
  • scripts/customise-cms/fields.js
  • scripts/customise-cms/generator.js
  • scripts/customise-cms/item-builders.js
  • src/snippets/footer-content.md
  • src/snippets/right-content.md
  • test/precommit/runner.js
  • test/unit/code-quality/pages-yml-reference-names.test.js
  • test/unit/precommit.test.js
  • test/unit/scripts/customise-cms/blocks.test.js
  • test/unit/scripts/customise-cms/config.test.js
  • test/unit/scripts/customise-cms/fields.test.js
  • test/unit/scripts/customise-cms/generator.test.js
  • test/unit/utils/pages-yml-helpers.js
💤 Files with no reviewable changes (1)
  • scripts/customise-cms/config.js

Comment thread scripts/customise-cms/fields.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6124e12938

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .pages.yml
@stefan-burke
stefan-burke added this pull request to the merge queue Jul 14, 2026
@stefan-burke
stefan-burke removed this pull request from the merge queue due to a manual request Jul 14, 2026
@stefan-burke
stefan-burke added this pull request to the merge queue Jul 14, 2026
Merged via the queue into main with commit cf97e51 Jul 14, 2026
14 checks passed
@stefan-burke
stefan-burke deleted the feature/pages-yml-name branch July 14, 2026 13:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94623aed9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

*/
const loadSnippet = (name, baseDir = process.cwd()) => {
const snippetPath = path.join(baseDir, "src/snippets", `${name}.md`);
const snippetName = path.basename(name, path.extname(name));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve dots in snippet slugs

When a snippet is referenced by its slug and that slug contains a dot, path.extname(name) treats the suffix as an extension, so render_snippet, snippet_data, and snippet_blocks now look for the wrong file (for example release.v1 becomes src/snippets/release.md instead of src/snippets/release.v1.md). The Pages CMS path case only needs to strip a trailing .md after taking the basename; otherwise existing dotted snippet filenames stop rendering.

Useful? React with 👍 / 👎.

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.

1 participant