Skip to content

Fixes 0.0.1a3#24

Merged
ryanmphill merged 3 commits intomainfrom
fixes-0.0.1a3
Dec 20, 2025
Merged

Fixes 0.0.1a3#24
ryanmphill merged 3 commits intomainfrom
fixes-0.0.1a3

Conversation

@ryanmphill
Copy link
Copy Markdown
Owner

This pull request introduces improvements to front matter handling in templates, enhances draft article exclusion logic, and adds new tests to ensure correct metadata inheritance from nested layouts. The changes also update the project metadata and test coverage for layout front matter.

Bug fix: Nested template layout frontmatter

  • There was an issue introduced after the latest big refactor where frontmatter was always being grabbed from the root layout template in /views/articles instead of the one correctly mapped to the given markdown file. This was because os.path.basename was incorrectly being used to get the template name at the last step before retrieving frontmatter, so it would always be layout.jinja instead of blog/layout.jinja or subject/layout.jinja, etc. This is now resolved by passing the original (correct) template name that was extracted earlier in the process to the get_front_matter method.

Front matter and draft handling improvements:

  • Improved draft exclusion logic in TemplateHandler: Articles and templates marked as drafts (via the draft field in front matter, supporting multiple representations like True, "true", "1", etc.) are now reliably excluded from output. [1] [2]
  • Enhanced front matter retrieval: The get_front_matter method now accepts both file_path and template_name parameters, improving its ability to extract metadata from both markdown and Jinja templates, especially for nested or included templates.

Project metadata and test coverage:

  • Added license file to project metadata and updated version to 0.0.1a3 in pyproject.toml.
  • Added front matter to the nested layout template layout.jinja for more explicit metadata inheritance in nested articles.
  • Added a new test to verify that article pages correctly inherit front matter (such as author and body_id) from their nested layout templates, ensuring metadata is properly reflected in the generated HTML.

…ted layouts

- Add template_name parameter to get_front_matter method signature
- Pass both file_path and template_name when calling get_front_matter in _process_template
- Ensure nested article layout templates properly extract and apply front matter
- Add test to verify article layout front matter hierarchy is respected
- Add front matter to blog/subject/layout.jinja test template

This fixes an issue where nested layout templates (e.g., articles/blog/subject/layout.jinja)
were not having their front matter properly extracted and applied, as the template_name
was being derived from file_path instead of being explicitly passed.
Consolidate draft checking to handle multiple truthy value formats
(boolean, string, integer) and apply consistently in both template
and article page processing.
@ryanmphill ryanmphill merged commit d6d687f into main Dec 20, 2025
6 checks passed
@ryanmphill ryanmphill deleted the fixes-0.0.1a3 branch December 20, 2025 23: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