~/blog/tags
- ls -l tags/
-
+ ls tags/
+
+
diff --git a/src/pages/tags/[...tag].astro b/src/pages/tags/[...tag].astro
index 3b74126..865a49a 100644
--- a/src/pages/tags/[...tag].astro
+++ b/src/pages/tags/[...tag].astro
@@ -4,7 +4,9 @@ import {getCollection} from "astro:content";
import ArticleList from "../../components/ArticleList.astro";
export async function getStaticPaths() {
- const allPosts = await getCollection('posts');
+ const allPosts = await getCollection('posts', ({ data }) => {
+ return import.meta.env.PROD ? data.draft !== true : true;
+});
const uniqueTags = [...new Set(allPosts.map((post: any) => post.data.tags ? post.data.tags : []).flat())];
return uniqueTags.map((tag) => {
const filteredPosts = allPosts.filter((post: any) => post.data.tags?.includes(tag));
diff --git a/src/pages/twtxt.txt.js b/src/pages/twtxt.txt.js
index 6af2c49..9311550 100644
--- a/src/pages/twtxt.txt.js
+++ b/src/pages/twtxt.txt.js
@@ -1,7 +1,9 @@
import { getCollection } from 'astro:content';
export async function GET(context) {
- const posts = await getCollection('posts');
+ const posts = await getCollection('posts', ({ data }) => {
+ return import.meta.env.PROD ? data.draft !== true : true;
+});
// Sort posts by date (newest first)
posts.sort((a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime());
diff --git a/src/plugins/heatmapdata/local.js b/src/plugins/heatmapdata/local.js
index 0c04586..470a3c7 100644
--- a/src/plugins/heatmapdata/local.js
+++ b/src/plugins/heatmapdata/local.js
@@ -1,7 +1,9 @@
import { getCollection, render } from 'astro:content';
async function fetchPostsData() {
- const posts = await getCollection('posts');
+ const posts = await getCollection('posts', ({ data }) => {
+ return import.meta.env.PROD ? data.draft !== true : true;
+});
const entriesData = {};
for (const post of posts) {