docusaurus 2.2: using the headTags API #318
Merged
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.
This PR migrates the blog to use the new
headTags
API that shipped with Docusaurus 2.2. There's two types of usage; the Web Monetization API and font preloading.This PR also updates blog posts to detail how to use the new API.
Web Monetization tags
We no longer need a plugin to add our head tags - we can pull that out in favour of an entry in the
headTags
entry:With this change in place we have the exact same outcome, but have to write less code.
See implementing commit here.
Font preloading tags
When it comes to font preloading, the difference is not so much less code (in fact we write slightly more code) but less dependencies. We get to say goodbye to the
webpack-font-preload-plugin
dependency in favour of twoheadTags
entries referencing our custom font:See implementing commit here.
You'll also note we move the fonts into the static directory so they can be easily referenced. They probably should have been there in the first place.