diff --git a/src/components/share.tsx b/src/components/share.tsx
new file mode 100644
index 00000000..225c1d7c
--- /dev/null
+++ b/src/components/share.tsx
@@ -0,0 +1,37 @@
+import { ShareIcon } from '@heroicons/react/24/solid';
+
+interface ShareProps {
+ title: string;
+ description: string;
+}
+
+function Share({ title, description }: ShareProps) {
+ const handleShareClick = () => {
+ const shareData = {
+ title: title,
+ text: description,
+ url: decodeURI(window.location.href),
+ };
+
+ if (navigator.canShare && navigator.canShare(shareData)) {
+ window.navigator.share();
+ } else {
+ navigator.clipboard.writeText(decodeURI(window.location.href));
+ }
+ };
+
+ return (
+
+
+
+ );
+}
+
+export default Share;
diff --git a/src/templates/post.tsx b/src/templates/post.tsx
index 419a3403..85647f42 100644
--- a/src/templates/post.tsx
+++ b/src/templates/post.tsx
@@ -3,11 +3,12 @@ import { graphql, type HeadProps, type PageProps } from 'gatsby';
import Comment from '@/components/comment';
import SEO from '@/components/seo';
+import Share from '@/components/share';
import TOC from '@/components/toc';
import typography from '@/components/typography';
function PostTemplate({ data: { mdx }, children }: PageProps) {
- const { title, date } = mdx.frontmatter;
+ const { title, description, date } = mdx.frontmatter;
return (
<>
@@ -21,6 +22,9 @@ function PostTemplate({ data: { mdx }, children }: PageProps)
{children}
+
+
+