@@ -10,6 +10,9 @@ import TOC from '@theme/TOC';
1010import Unlisted from '@theme/Unlisted' ;
1111import GiscusComponent from '@site/src/components/GiscusComponent' ;
1212import { PostPaginator } from '@site/src/components/blog/post-paginator' ;
13+ import { LinkedinShareButton , RedditShareButton , TwitterShareButton , RedditIcon , LinkedinIcon } from 'react-share' ;
14+ import { Twitter } from './icons' ;
15+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
1316
1417function getMultipleRandomPosts ( relatedPosts , number ) {
1518 // Create a copy of the original array to avoid modifying it
@@ -53,9 +56,8 @@ function getMultipleRandomPosts(relatedPosts, number) {
5356
5457function BlogPostPageContent ( { children } ) {
5558 const { metadata, toc } = useBlogPost ( ) ;
56- const { relatedPosts } = metadata ;
5759
58- const { nextItem, prevItem, frontMatter, unlisted } = metadata ;
60+ const { relatedPosts , nextItem, prevItem, frontMatter, unlisted, permalink , title , description } = metadata ;
5961 const {
6062 hide_table_of_contents : hideTableOfContents ,
6163 toc_min_heading_level : tocMinHeadingLevel ,
@@ -65,6 +67,9 @@ function BlogPostPageContent({ children }) {
6567 const randomThreeRelatedPosts = getMultipleRandomPosts ( relatedPosts , 3 ) ;
6668
6769 console . log ( 'relatedPosts' , relatedPosts ) ;
70+ const {
71+ siteConfig : { url } ,
72+ } = useDocusaurusContext ( ) ;
6873
6974 return (
7075 < BlogLayout
@@ -77,6 +82,36 @@ function BlogPostPageContent({ children }) {
7782 { unlisted && < Unlisted /> }
7883
7984 < BlogPostItem > { children } </ BlogPostItem >
85+ < div className = "flex items-center gap-3 pt-10 not-prose" >
86+ < span className = "text-base" > Share on</ span >
87+ < TwitterShareButton
88+ windowWidth = { 750 }
89+ windowHeight = { 800 }
90+ url = { url + permalink }
91+ className = "flex"
92+ title = { title }
93+ >
94+ < Twitter width = { 36 } height = { 36 } />
95+ </ TwitterShareButton >
96+ < RedditShareButton
97+ className = "flex"
98+ windowWidth = { 750 }
99+ windowHeight = { 600 }
100+ url = { url + permalink }
101+ title = { title }
102+ >
103+ < RedditIcon size = { 36 } round />
104+ </ RedditShareButton >
105+ < LinkedinShareButton
106+ url = { url + permalink }
107+ title = { title }
108+ source = { url }
109+ summary = { description }
110+ className = "flex"
111+ >
112+ < LinkedinIcon size = { 36 } round />
113+ </ LinkedinShareButton >
114+ </ div >
80115 < PostPaginator title = "Related Articles" posts = { randomThreeRelatedPosts } > </ PostPaginator >
81116 < GiscusComponent />
82117 { ( nextItem || prevItem ) && < BlogPostPaginator nextItem = { nextItem } prevItem = { prevItem } /> }
0 commit comments