feat(extensions)!: pre_render phase#138
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/1callback. Theycan implement a callback named after the build phase:
pre_build/1,pre_render/1, etcfix!: 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 runfind _site/ | sort > after.txtand then comparing the files to look for differences.