feat: add newsletter to blog posts page

This commit is contained in:
草师傅 2025-06-23 22:51:09 +08:00
parent 862acbd1f1
commit 03ce3caefd
3 changed files with 53 additions and 3 deletions

View file

@ -1,6 +1,8 @@
---
import Layout from '../layouts/Layout.astro';
import { getCollection } from 'astro:content';
import NewsLetter from "../components/NewsLetter.astro";
import {siteConfig} from "../config";
const posts = await getCollection('posts');
posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime());
@ -38,6 +40,7 @@ posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDat
<br />
<a href="/rss.xml" style="margin-left: 1rem;">Subscribe to RSS feed</a>
</p>
{siteConfig.newsletter.enabled && <NewsLetter listmonkInstance={siteConfig.newsletter.listmonk.instanceDomain} listuuid={siteConfig.newsletter.listmonk.listuuid} />}
</div>
</div>
</Layout>