Skip to content

feat: consume defaults in _config.yml#25

Merged
cyjake merged 3 commits intomasterfrom
support-config-defaults
Nov 16, 2025
Merged

feat: consume defaults in _config.yml#25
cyjake merged 3 commits intomasterfrom
support-config-defaults

Conversation

@cyjake
Copy link
Owner

@cyjake cyjake commented Nov 16, 2025

fixes #19

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements support for consuming defaults configuration from _config.yml, addressing issue #19. The implementation allows users to define default front matter values for pages and posts based on path and type scopes, following Jekyll's defaults pattern.

Key Changes

  • Added getDefaults() function to apply default values from _config.yml to pages during the templating process
  • Added type property to Post and Page parsers to enable type-based default matching
  • Updated highlight.js API usage to accommodate breaking changes in v11
  • Refactored test suite structure with new unit tests organized by functionality

Reviewed Changes

Copilot reviewed 16 out of 34 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/writers/templated.js Implements getDefaults() function for applying defaults from config; refactored to use async/await pattern and fs/promises
lib/parsers/post.js Added type property to distinguish between 'posts' and 'drafts'
lib/parsers/page.js Added type property set to 'pages'; fixed URL generation for markdown files
lib/highlight.js Updated highlight.js API call from old highlight(lang, code) to new highlight(code, { language }) format
test/unit/site.test.js New unit tests for Site class, including test coverage for defaults feature
test/unit/parsers/post.test.js New unit tests for post parsing functionality
test/unit/parsers/page.test.js New unit tests for page parsing functionality
test/unit/writers/templated.test.js New unit tests for templated writer
test/unit/liquid.test.js Updated import path to match new test directory structure
test/site.test.js Removed old test file as functionality moved to unit tests
test/fixture/defaults/* New test fixture demonstrating defaults feature with layouts and scoped defaults
test/fixture/basic/* New basic test fixture for core functionality testing
package.json Updated test script to run tests recursively

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Nov 16, 2025

@cyjake I've opened a new pull request, #26, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI mentioned this pull request Nov 16, 2025
* Initial plan

* Fix typo in test comment: mattter → matter

Co-authored-by: cyjake <252317+cyjake@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cyjake <252317+cyjake@users.noreply.github.com>
@cyjake cyjake merged commit 5e98d2b into master Nov 16, 2025
15 checks passed
@cyjake cyjake deleted the support-config-defaults branch November 16, 2025 11:22
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.

Please support default values in _config.yml

3 participants