From 2931e05fbc503e491b95145980bfc77a2b639afa Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Sat, 9 Nov 2024 23:09:32 -0500 Subject: [PATCH] add rework to books read list --- src/components/Books/BooksAlreadyRead.tsx | 5 +++++ src/components/Books/BooksToRead.tsx | 5 ----- src/plugins/blog-post-plugin.js | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 src/plugins/blog-post-plugin.js diff --git a/src/components/Books/BooksAlreadyRead.tsx b/src/components/Books/BooksAlreadyRead.tsx index 778444e44d..45c859705c 100644 --- a/src/components/Books/BooksAlreadyRead.tsx +++ b/src/components/Books/BooksAlreadyRead.tsx @@ -425,6 +425,11 @@ const data = [ author: "Nassim Nicholas Taleb", image: "/books/skin-in-the-game-hidden-asymmetries-in-daily-life.jpg", }, + { + title: "Rework", + author: "Jason Fried, David Heinemeier Hansson", + image: "/books/rework.jpeg", + }, ]; export default function BooksAlreadyRead() { diff --git a/src/components/Books/BooksToRead.tsx b/src/components/Books/BooksToRead.tsx index a7ce166346..9b213c7b1a 100644 --- a/src/components/Books/BooksToRead.tsx +++ b/src/components/Books/BooksToRead.tsx @@ -247,11 +247,6 @@ const data = [ image: "/books/built-to-sell-creating-a-business-that-can-thrive-without-you.jpeg", }, - { - title: "Rework", - author: "Jason Fried, David Heinemeier Hansson", - image: "/books/rework.jpeg", - }, { title: "Resilience: Hard-Won Wisdom for Living a Better Life", author: "Eric Greitens", diff --git a/src/plugins/blog-post-plugin.js b/src/plugins/blog-post-plugin.js new file mode 100644 index 0000000000..a0f03b45f3 --- /dev/null +++ b/src/plugins/blog-post-plugin.js @@ -0,0 +1,16 @@ +module.exports = (context, options) => ({ + name: 'blog-post-plugin', + async contentLoaded({ content, actions }) { + const { setGlobalData } = actions; + const { blogPosts } = content; + + const updatedBlogPosts = blogPosts.map((post) => { + const updatedContent = + post.content + + '\n\nThis sentence is added to the end of every blog post.'; + return { ...post, content: updatedContent }; + }); + + setGlobalData({ updatedBlogPosts }); + }, +});