feat: post reply via email (WIP)

This commit is contained in:
grassblock 2025-05-23 17:11:25 +08:00
parent a74b7619d0
commit cbdc63a6eb
2 changed files with 10 additions and 3 deletions

View file

@ -0,0 +1,4 @@
---
const { title } = Astro.props;
---
<a href={`mailto:test@email.com?subject=RE:${title}&body=Hi,\n\nI would like to reply to your post "${title}".`}>Reply via Email</a>

View file

@ -7,6 +7,8 @@ import { unified } from "unified";
import { select } from "unist-util-select"; import { select } from "unist-util-select";
import remarkMdx from "remark-mdx"; import remarkMdx from "remark-mdx";
import remarkParse from "remark-parse"; import remarkParse from "remark-parse";
import {siteConfig} from "../../config";
import ReplyViaEmail from "../../components/ReplyViaEmail.astro";
export async function getStaticPaths() { export async function getStaticPaths() {
const blogEntries = await getCollection('posts'); const blogEntries = await getCollection('posts');
@ -17,7 +19,7 @@ export async function getStaticPaths() {
const { entry } = Astro.props; const { entry } = Astro.props;
const { Content } = await entry.render(); const { Content } = await entry.render();
const noscript = siteConfig.noClientJavaScript
const slug = Astro.params.slug; const slug = Astro.params.slug;
// get featured image and use it as og:image // get featured image and use it as og:image
@ -45,9 +47,10 @@ const cover = customFeaturedImage || matchedImage_src?.src || `/post/${slug}/fea
</div> </div>
<div style="margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1rem;"> <div style="margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1rem;">
<h2>Comments</h2> <ReplyViaEmail title={entry.data.title} />
<Comments path={`post/${slug}`} /> <br>
<a href="/blog">&larr; Back to posts</a> <a href="/blog">&larr; Back to posts</a>
{noscript && <h2>Comments</h2> <Comments path={`post/${slug}`} />}
</div> </div>
</Layout> </Layout>