Skip to content

feat(extensions)!: pre_render phase#138

Merged
mhanberg merged 1 commit into
mainfrom
pre-render
Jun 21, 2025
Merged

feat(extensions)!: pre_render phase#138
mhanberg merged 1 commit into
mainfrom
pre-render

Conversation

@mhanberg

@mhanberg mhanberg commented Jun 20, 2025

Copy link
Copy Markdown
Collaborator

The pre_render phase is ran after the pre_build phase but before the
graph is traversed and every page is rendered to HTML.

Extensions are also now able to mount to multiple phases in the build
cycle. This allows extensions like the Page and Post extension to
separate the construction of their pages/posts into separate phases.

Doing so means that other extensions are able to modify the data
structures in the token before they are rendered. For example, you can
implement a Table of Contents extension that loops through each post,
creates a TOC structure from markdown headings, then put that structure
into the post data in the token.

This data is then in the token and available to use in layouts.

BREAKING CHANGE: Extensions no longer implement a run/1 callback. They
can implement a callback named after the build phase: pre_build/1,
pre_render/1, etc

fix!: correctly slugify permalinks

BREAKING CHANGE: This switches to using the slugify
package for creating slugs. This leads to better slugs, but also means
your existing page's permalinks might change, which might break
backlinks. When upgrading, please check for permalink changes so that
you can set up the proper redirects. You can easily do this by building your site before the update, running find _site/ | sort > before.txt, then updating, deleting and rebuilding your site, then run find _site/ | sort > after.txt and then comparing the files to look for differences.

@mhanberg mhanberg changed the title feat!(extensions): pre_render phase feat(extensions)!: pre_render phase Jun 20, 2025
The pre_render phase is ran after the pre_build phase but before the
graph is traversed and every page is rendered to HTML.

Extensions are also now able to mount to multiple phases in the build
cycle. This allows extensions like the Page and Post extension to
separate the construction of their pages/posts into separate phases.

Doing so means that other extensions are able to modify the data
structures in the token before they are rendered. For example, you can
implement a Table of Contents extension that loops through each post,
creates a TOC structure from markdown headings, then put that structure
into the post data in the token.

This data is then in the token and available to use in layouts.

BREAKING CHANGE: Extensions no longer implement a `run/1` callback. They
can implement a callback named after the build phase: `pre_build/1`,
`pre_render/1`, etc

fix!: correctly slugify permalinks

BREAKING CHANGE: This switches to using the [slugify](https://hex.pm/packages/slugify)
package for creating slugs. This leads to better slugs, but also means
your existing page's permalinks might change, which might break
backlinks. When upgrading, please check for permalink changes so that
you can set up the proper redirects. You can easily do this by building
your site before the update, running `find _site/ | sort > before.txt`,
then updating, deleting and rebuilding your site, then run
`find _site/ | sort > after.txt` and then comparing the files to look
for differences.
@mhanberg
mhanberg merged commit a8a819e into main Jun 21, 2025
7 checks passed
@mhanberg
mhanberg deleted the pre-render branch June 21, 2025 18:36
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