Conversation
- replaced slate editor;
- publishing now pushes and generates changes directly to html as 'content_html' - updated graphQL schemas to reflect this change
- created estimateReadTime function; - added richText renderer; - added several components for each block;
- added DOMpurify to sanitize HTML to prevent potential XSS vulnerabilities
…rs/scaffold-blogpost-page
- changed to isomorphic-dompurify package, which contains wrappers to enable DOMPurify on server
- $slug var was missing
…rs/scaffold-blogpost-page
davelange
reviewed
Sep 23, 2024
| // TODO: Extend to format talks-and-roundtables to Talks & Roundtables | ||
| // TODO: Extend to fromat case-studies to Case Studies | ||
|
|
||
| return text.charAt(0).toLowerCase() + text.slice(1) |
Contributor
There was a problem hiding this comment.
What is this for, to turn the word into lower case?
Collaborator
Author
There was a problem hiding this comment.
it's a converter to convert what ArchiveButton receives and make a compatible key of collections
Contributor
There was a problem hiding this comment.
This is the same as just text.toLowerCase() though
| @@ -0,0 +1,7 @@ | |||
| export function estimateReadTime(text: string): string { | |||
| const WPM = 250 | |||
| const wordCount = text.split(/\s+/).length | |||
Contributor
There was a problem hiding this comment.
Ideally this could be kept on the CMS, through an onUpdate hook or something. Because splitting a string might be costly when the string is an entire blogpost. But it's ok for now 👍
Collaborator
Author
There was a problem hiding this comment.
noted! will make this an issue
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.
Why:
blogposts/[slug]was currently just rendering JSON stringified data which was not working as intented.How:
Before:


After (to be styled):