From 03ce3caefd1a157f99d754bb8f71a740593c1a72 Mon Sep 17 00:00:00 2001
From: grassblock
Date: Mon, 23 Jun 2025 22:51:09 +0800
Subject: [PATCH] feat: add newsletter to blog posts page
---
src/components/NewsLetter.astro | 39 +++++++++++++++++++++++++++++++++
src/config.ts | 14 +++++++++---
src/pages/blog.astro | 3 +++
3 files changed, 53 insertions(+), 3 deletions(-)
create mode 100644 src/components/NewsLetter.astro
diff --git a/src/components/NewsLetter.astro b/src/components/NewsLetter.astro
new file mode 100644
index 0000000..d4b77cc
--- /dev/null
+++ b/src/components/NewsLetter.astro
@@ -0,0 +1,39 @@
+---
+const { listmonkInstance, listuuid } = Astro.props;
+
+const inputId = Astro.props.listuuid.substring(0,5)
+---
+
+Subscribe to newsletter
+
+
+
\ No newline at end of file
diff --git a/src/config.ts b/src/config.ts
index 5f41684..8f14d49 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -28,14 +28,19 @@ export const siteConfig = {
searchEngine: 'duckduckgo', // 'google', 'duckduckgo', 'bing' (broken until M1cr0$0ft get support for it), defaults to 'google'
// content
displayAvatar: true, // display author avatar in the article list and info line of article page
+ newsletter: {
+ enabled: false, // enable newsletter subscription in post list page
+ type: 'listmonk', // only 'listmonk' is supported for now, more will be added later
+ listmonk: {
+ instanceDomain: 'listmonk.yourdomain.com', // the domain of your listmonk instance
+ listuuid: '3546fc35-fd75-4163-936a-114514191981', // the id of the list to subscribe to, can be found in the listmonk admin panel
+ }
+ },
// encryption
// the global password to encrypt/decrypt the content, if set, all without specifying a password will be encrypted with this password
// To use an environment variable to set the password, replace the value with `import.meta.env.CONTENT_PASSWORD`
// (or process.env.CONTENT_PASSWORD, CONTENT_PASSWORD can be any string) and set the environment variable in your deployment service.
contentPassword: 'p1easeChangeMe!',
- // footer
- // yes you can write html safely here
- customFooter: 'I have no mouth, and I must SCREAM',
// comments
comments: {
type: 'artalk', // 'artalk','giscus','fediverse','email','hatsu'
@@ -83,6 +88,9 @@ export const siteConfig = {
instanceDomain: '',
}
},
+ // footer
+ // yes you can write html safely here
+ customFooter: 'I have no mouth, and I must SCREAM',
// umami analytics
// by enabling this, you can track the visitors of your site
siteAnalytics: {
diff --git a/src/pages/blog.astro b/src/pages/blog.astro
index d3b3a7d..44f6b9a 100644
--- a/src/pages/blog.astro
+++ b/src/pages/blog.astro
@@ -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
Subscribe to RSS feed
+ {siteConfig.newsletter.enabled && }
\ No newline at end of file