This repository was archived by the owner on May 24, 2022. It is now read-only.
Add Blog posts, components, and local caching system#57
Merged
Conversation
…c file path names and to bypass Next.js limitation in sharing between static paths and props
katjuell
commented
Mar 25, 2022
katjuell
commented
Mar 25, 2022
katjuell
commented
Mar 25, 2022
katjuell
commented
Mar 25, 2022
katjuell
commented
Mar 25, 2022
katjuell
commented
Mar 25, 2022
katjuell
commented
Mar 25, 2022
katjuell
commented
Mar 25, 2022
Contributor
Author
|
@bretthayes this should be error-free now following #55 ! |
bretthayes
suggested changes
Apr 5, 2022
Contributor
bretthayes
left a comment
There was a problem hiding this comment.
Phew! What a port! My machine struggled to load the Files Changed tab lol.
Awesome work on this!! 🚀 Left a few comments on some small things below.
Contributor
Contributor
Author
|
@bretthayes added some error handling in the templates. You can test by removing either of the cache files after the initial build — you should be redirected to 404s in both cases |
bretthayes
approved these changes
Apr 6, 2022
Contributor
bretthayes
left a comment
There was a problem hiding this comment.
Wonderful! Looks good to me!
Contributor
Author
|
w00t! Thanks for the massive review here |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Closes #32 and resolves #33 by adding all blog records and blog components.
Also adds a local file and slug caching system, for a few reasons: it's a good idea to minimize page compute and page props size. By having a local file directory cache and slug cache, we can ensure that the values we need to build our pages are pre-computed. We can also ensure that we don't pass massive globs of data as page props.
An important piece of inspiration for this was also this discussion about the known limitations in passing data between
staticPathsandstaticProps, particularly this comment and this related repo.There were a few tricky bits with this workflow:
blogpostscontent directory. They will now be served from/blog/<conference-directory>/<slug>.2020,2021, etc). Those values cannot be present in the slugs, however.frontmatterdo not align with the file name.I have addressed these issues in how the slugs get set, and have made pulling the correct file path name a (hopefully) simple, object-based exercise of
files.records[fileSlug].filePath(withfilesbeing the cached JSON with our complete record info).IMPORTANT: Static builds will not work with this workflow. This is because we still need to work on #56, which was a big enough task for me to offload it to another issue. I'd like to get this work in first, so this will block that work until merged. Likewise, the cache workflow has not been added to our build scripts.
Also, podcasts will not work. Different issue.
To Test
yarn devand navigate to any of the existing terms pages (should all work) and any blog post. Some of them will not work thanks to Migrate all embedded blog styles in MD to work with new parsing pipeline #56 but enough do that you should be able to get a sense:/blog/go/a-go-guide-to-syscalls,/blog/integration-testing, etc./blog/software-engineer-career-ladderfor example.