Skip to content

Comments

feat: Programmatic pages#41

Merged
kevinrenskers merged 4 commits intomainfrom
feat/programmatic-pages
Feb 24, 2026
Merged

feat: Programmatic pages#41
kevinrenskers merged 4 commits intomainfrom
feat/programmatic-pages

Conversation

@kevinrenskers
Copy link
Member

@kevinrenskers kevinrenskers commented Feb 24, 2026

  • It's currently not very easy to render the homepage with a specific html template, because when you leave the folder empty, it processes ALL markdown, recursive. It's not clear how to make a processing step that only processes the homepage, without also processing other pages (such as the about page). Maybe a filter that ignores everything except /index.md, but is that obvious enough. We can do better.

  • It's currently not clear to how render a template to a HTML page wihhout there being an Item involved (like a markdown file). Let's say I have an HTML template render404 and I want to render this to /404.html. What kind of register step would make that possible? The new programmatic step with the fetch method that just returns a dummy Item?

The solution: a new createPage step.

try await Saga(input: "content", output: "deploy")
  .register(
    folder: "articles",
    metadata: ArticleMetadata.self,
    readers: [.parsleyMarkdownReader],
    writers: [
      .itemWriter(swim(renderArticle)),
      .listWriter(swim(renderArticles)),
    ]
  )
  .createPage("index.html", using: swim(renderHome))
  .createPage("404.html", using: swim(render404))
  .run()

I also deprecated the staticFiles step. run now just always copies the static files.

@kevinrenskers kevinrenskers merged commit 1a2f124 into main Feb 24, 2026
2 checks passed
@kevinrenskers kevinrenskers deleted the feat/programmatic-pages branch February 24, 2026 01:01
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