Skip to content

Query functions and post pagination#19

Merged
ryanmphill merged 27 commits intomainfrom
query-functions-and-post-pagination
Dec 1, 2025
Merged

Query functions and post pagination#19
ryanmphill merged 27 commits intomainfrom
query-functions-and-post-pagination

Conversation

@ryanmphill
Copy link
Copy Markdown
Owner

@ryanmphill ryanmphill commented Nov 29, 2025

This introduces several new key features to help round out Shodo as a static site generator, including:

  • Query functions to filter and sort through both markdown articles and json in the store directory. This includes:
    • shodo_get_articles()
    • shodo_query_store()
  • Automatic pagination when using the new query functions, including generated HTML page links
  • XML support for RSS/Atom feed generation, along with helper functions passed to templates for proper formatting, including
    • rel_to_abs() to ensure all links are absolute paths
    • get_rfc822() to ensure dates are RFC 822 format
  • New cli command shodo now, which is helpful to get a current UTC date string in the proper format for the published_datetime frontmatter field in markdown articles when creating a new post
  • A newly updated starter template to easily be able to create a blogging site after scaffolding the project via start-shodo-project

Resolves #15
Resolves #16
Resolves #17
Resolves #18

Add pagination support with  and  front matter options.
Automatically generates multiple pages for article listings with navigation.

Refactor template rendering architecture to support pagination:
- Extract pagination logic into PaginationHandler
- Create modular components (API, TemplateContext, HTMLRootLayoutBuilder)
- Add filter extraction from template queries
- Include pagination UI styling in default scaffolding template

Add comprehensive test coverage for pagination and new modules.
Add new template function to query JSON data from store directory with
full filtering, ordering, limit/offset, and pagination capabilities.

- Implement shodo_query_store() with same filter syntax as shodo_get_articles()
- Support pagination via 'paginate: shodo_query_store' in front matter
- Refactor shared filtering logic into reusable API methods
- Move format_md_page_data to TemplateContext
- Add datetime parsing and timezone conversion for articles
- Update templates to use article.content for proper rendering
- Add comprehensive test coverage for store queries and pagination
Add XML file rendering and feed-specific template functions to enable
RSS/Atom feed generation from markdown articles.

New API functions:
- get_rfc822() for RFC 822 date formatting
- rel_to_abs() to convert relative URLs to absolute
- current_dt() to get current build datetime

Template improvements:
- Support file_type: xml in front matter
- Add no_wrapper option to skip HTML structure
- Enable Jinja trim_blocks/lstrip_blocks for cleaner XML

Data handling:
- Parse date strings to datetime objects for proper sorting
- Add timezone conversion support for article dates
- Improve datetime normalization with error handling and logging

This allows users to create valid RSS/Atom feeds using Jinja templates
with proper date formatting and absolute URLs for feed readers.
The testing template can now focus on implementing all features that should be tested, while the main project template in the package can focus on giving a clean start to scaffolding a new site
…entation around global variables such as 'metadata' or 'url_origin' can be more organized
Extract  from PaginationHandler into
JSONLoader class to centralize JSON string formatting logic.

- Add method to JSONLoader with comprehensive quote/escape handling
- Update PaginationHandler, FrontMatterProcessor, and JSONLoader.load_args to use it
- Add extensive test coverage for complex quote scenarios
- Eliminate code duplication across three modules
Rename ImageWriter to AssetWriter and change images_path to assets_path to
support multiple static asset types (images, fonts, downloads, etc.).

- Rename ImageWriter → AssetWriter, AssetWriter → BaseAssetWriter
- Update images_path → assets_path in settings
- Move static files to /static/assets directory structure
- Update all imports, tests, and documentation
Add RootFilesWriter class to copy files from src/root/ directly to the
build root directory, enabling static files like robots.txt and sitemap.xml.

- Create RootFilesWriter with directory merging support
- Add root_files_path to build_settings.json
- Wire up in assembler, static_site_generator, and tests
- Handle overwrite warnings and graceful skipping
- Add test coverage for file/directory copying and merging
… are marked as xml files

Default behavior for HTML files is to have an index file inside the named directory. XML files should be standalone, so no additional directory with the file's name is needed.
@ryanmphill ryanmphill merged commit e26f791 into main Dec 1, 2025
6 checks passed
@ryanmphill ryanmphill deleted the query-functions-and-post-pagination branch December 3, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant