Skip to content

feat: Add a content definitions module - #4431

Open
tvdeyen wants to merge 7 commits into
mainfrom
definitions-module
Open

tvdeyen wants to merge 7 commits into
mainfrom
definitions-module

Conversation

@tvdeyen

@tvdeyen tvdeyen commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What is this pull request for?

Page types and elements are defined in YAML by developers, but editors have no way to see in the admin what a page type offers, which elements can be placed on it, or how often those elements are actually used. This adds a read-only Definitions module, available from the main menu for authors and above, that lists every page type with its hint, labels, an optional preview image and its available elements, including nested elements and their ingredients. Each element shows how often it is used on draft versions of that page type next to its total across all page types, so it becomes visible what is really in use before a definition gets changed.

The sidebar always lists all page types, grouped into content pages and global pages. A filter button narrows the definitions to a single page type, while the search box highlights matching page type and element names on top of that and unfolds elements whose nested elements match. The page type in the page info dialog links straight to its filtered definition.

Notable changes

Page definitions accept a new image option in page_layouts.yml, which is shown as a preview in the module. The usage numbers come from two grouped queries instead of one count per element, because large installations render hundreds of them on this page.

While building the layout this also fixes a needless scrollbar on the resource index pages and the pages tree, which were sized taller than the visible area. The ingredient types of the Spree extension get their model name translations in alchemy-solidus itself, see AlchemyCMS/alchemy-solidus#159. New translations are English only for now.

Screenshots

Screen Shot 2026-10-31 at 14 57 59 Screen Shot 2026-10-31 at 14 55 45 Screen Shot 2026-10-31 at 14 56 41

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@tvdeyen tvdeyen added this to the 9.0 milestone Oct 30, 2026
@netlify

netlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for alchemy-guides canceled.

Name Link
🔨 Latest commit 332728d
🔍 Latest deploy log https://app.netlify.com/projects/alchemy-guides/deploys/6ae5f4392d5d358dfea214f2

@tvdeyen
tvdeyen force-pushed the definitions-module branch from 9450308 to 4f493d7 Compare October 30, 2026 13:30
@tvdeyen
tvdeyen force-pushed the definitions-module branch from 4f493d7 to db9b5d6 Compare October 30, 2026 14:29
@tvdeyen tvdeyen self-assigned this Oct 30, 2026
@tvdeyen
tvdeyen force-pushed the definitions-module branch 3 times, most recently from cd55228 to 39fbc03 Compare October 30, 2026 21:47
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.42%. Comparing base (0883684) to head (332728d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4431   +/-   ##
=======================================
  Coverage   98.41%   98.42%           
=======================================
  Files         371      373    +2     
  Lines        9845     9880   +35     
=======================================
+ Hits         9689     9724   +35     
  Misses        156      156           
Flag Coverage Δ
mariadb 97.05% <100.00%> (+0.01%) ⬆️
mysql 95.97% <100.00%> (+0.01%) ⬆️
postgresql 95.97% <100.00%> (+0.01%) ⬆️
sqlite 95.97% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen
tvdeyen force-pushed the definitions-module branch from 39fbc03 to 02cc75d Compare October 31, 2026 11:03
Helps to visualize the usage of the page.
The resource table wrapper was sized to the full height of the main
content although the resources header sits above it, and the lazy loaded
pages tree used a viewport based height that ignored the main content
padding and the collapsing margin of its heading. Both made the main
content scrollable even when everything fit on screen.
Editors who want to know what a page type offers had to find it in the
definitions module themselves. Linking the page type from the page info
dialog opens the definitions filtered to and scrolled to that page type.
Global pages are only edited as layout parts and never visited by URL, so
mixing them with regular page types made the list harder to scan. Content
page types now come first and global page types second, each under its own
heading in the sidebar.
@tvdeyen
tvdeyen force-pushed the definitions-module branch 2 times, most recently from d97e635 to 85ff1c1 Compare October 31, 2026 13:49
Searching hid every page type without a match, so the overview of all page
types disappeared while looking for an element. A dedicated page type filter
now narrows the definitions while the sidebar always lists every page type,
and the search only highlights page type and element names on top of it.
The page info dialog links to the filtered page type directly.
@tvdeyen
tvdeyen force-pushed the definitions-module branch from 85ff1c1 to 332728d Compare October 31, 2026 13:59
@tvdeyen tvdeyen changed the title feat: Add definitions module feat: Add a content definitions module Oct 31, 2026
@tvdeyen
tvdeyen marked this pull request as ready for review October 31, 2026 14:03
@tvdeyen
tvdeyen requested a review from a team as a code owner October 31, 2026 14:03
@tvdeyen tvdeyen removed their assignment Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants