Skip to content

fix: avoid rendering empty custom front matter#116

Merged
rokuosan merged 1 commit intomainfrom
fix-empty-custom-frontmatter
Apr 30, 2026
Merged

fix: avoid rendering empty custom front matter#116
rokuosan merged 1 commit intomainfrom
fix-empty-custom-frontmatter

Conversation

@rokuosan
Copy link
Copy Markdown
Owner

@rokuosan rokuosan commented Apr 30, 2026

Summary

This PR fixes a rendering bug where an empty custom front matter object ({}) was emitted into the generated front matter block.

Root Cause

When custom front matter only contained fields already handled by the renderer, such as title, those known fields were consumed and removed before serialization. The remaining map became empty, but it was still marshaled and appended to the output, which produced {} in the front matter.

Changes

  • Skip serializing additional front matter when no custom keys remain after applying known field overrides.
  • Update renderer tests to assert that empty custom front matter is no longer emitted.

Impact

  • Generated article front matter no longer includes a stray empty object.
  • Cases with real custom front matter continue to render as before.

Validation

  • go test ./pkg/core/...

@rokuosan rokuosan self-assigned this Apr 30, 2026
@rokuosan rokuosan merged commit 7d8b91e into main Apr 30, 2026
4 checks passed
@rokuosan rokuosan deleted the fix-empty-custom-frontmatter branch April 30, 2026 14:21
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