Add site data files for templates#67
Conversation
|
Warning Review limit reached
More reviews will be available in 38 minutes and 19 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds support for “site data” YAML files under content/data/ by parsing them into SiteConfig::$data and exposing that map to entry + generated page templates, while ensuring content/data is excluded from collection/entry discovery and tracked for incremental rebuilds.
Changes:
- Parse
content/data/*.yaml|*.ymlintoSiteConfig::$data(via newSiteDataParser). - Expose
$datato templates rendered byEntryRendererand various page writers (taxonomy, archives, authors, listings, 404). - Exclude
data/from content parsing and include its YAML files in the build’s tracked “config files”; update docs/roadmap and add tests.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Content/Parser/SiteConfigParserTest.php | Adds tests for parsing site data files + friendly error on invalid YAML. |
| tests/Unit/Content/Parser/ContentParserTest.php | Verifies content/data is not treated as a collection/entries source. |
| tests/Unit/Build/EntryRendererTest.php | Verifies templates can read $data provided by the renderer. |
| src/Content/Parser/SiteDataParser.php | New parser to load YAML site data files from content/data/. |
| src/Content/Parser/SiteConfigParser.php | Loads parsed site data into SiteConfig when parsing config.yaml. |
| src/Content/Parser/ContentParser.php | Excludes data/ from collection discovery and entry parsing. |
| src/Content/Model/SiteConfig.php | Adds public array $data = [] to hold site data. |
| src/Console/BuildCommand.php | Tracks `content/data/*.yaml |
| src/Build/TaxonomyPageWriter.php | Passes $data into taxonomy templates. |
| src/Build/NotFoundPageWriter.php | Passes $data into the 404 template. |
| src/Build/EntryRenderer.php | Passes $data into entry templates. |
| src/Build/DateArchiveWriter.php | Passes $data into archive templates. |
| src/Build/CollectionListingWriter.php | Passes $data into collection listing templates. |
| src/Build/AuthorPageWriter.php | Passes $data into author templates. |
| roadmap.md | Marks the site-data-to-templates roadmap item as done. |
| docs/templates.md | Documents $data as an available template variable. |
| docs/content.md | Documents content/data/ structure and usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $parsed = @yaml_parse($content); | ||
| if ($parsed === false) { | ||
| throw new InvalidContentConfigException( | ||
| "Invalid YAML in site data file: $path", | ||
| $path, | ||
| 'Fix the YAML syntax in content/data/*.yaml, then run the build again.', | ||
| ); | ||
| } |
| ); | ||
| } | ||
|
|
||
| $key = basename($item->getFilename(), '.' . $extension); |
| | `$uiLanguages` | `list<string>` | Available UI languages exposed by the site | | ||
| | `$uiCatalogs` | `array<string, array<string, string>>` | Theme UI catalogs for client-side switching | | ||
| | `$ui` | `YiiPress\I18n\UiText` | Injected localized UI-text helper for bundled theme labels | | ||
| | `$data` | `array<string, mixed>` | Site data loaded from `content/data/*.yaml` | |
| - [x] Theme system — installable/distributable themes | ||
| - [x] Template partials/includes support | ||
| - [x] Template helper functions documentation | ||
| - [x] Site data files exposed to templates (`content/data/*.yaml` as `$data`) |
Summary
Tests