diff --git a/src/components/shortcodes/Spoiler.astro b/src/components/shortcodes/Spoiler.astro index 48b985d..319f3f6 100644 --- a/src/components/shortcodes/Spoiler.astro +++ b/src/components/shortcodes/Spoiler.astro @@ -1,17 +1,9 @@ --- const { tip = '' } = Astro.props -let divNeeded = false -const content = await Astro.slots.render('default') -if (content.includes('

')) { - divNeeded = true -} - --- -{divNeeded ? -

- : - -} + + + \ No newline at end of file diff --git a/src/pages/categories/[...category].astro b/src/pages/categories/[...category].astro index 3b3a3d4..c1c1b13 100644 --- a/src/pages/categories/[...category].astro +++ b/src/pages/categories/[...category].astro @@ -4,9 +4,7 @@ import {getCollection} from "astro:content"; import ArticleList from "../../components/ArticleList.astro"; export async function getStaticPaths() { - const allPosts = await getCollection('posts', ({ data }) => { - return import.meta.env.PROD ? data.draft !== true : true; -}); + const allPosts = await getCollection('posts'); // Get all categories, ensuring the default 'uncategorized' is used when categories is undefined const uniqueCategories = [...new Set(allPosts.map((post: any) => post.data.categories || ['uncategorized']).flat())]; diff --git a/src/pages/index.astro b/src/pages/index.astro index 7d80dd8..c04253a 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -12,7 +12,7 @@ try { } --- - +

~/

{HomePageContent ? : diff --git a/src/pages/search-index.json.js b/src/pages/search-index.json.js index 65da20b..8686b3b 100644 --- a/src/pages/search-index.json.js +++ b/src/pages/search-index.json.js @@ -1,9 +1,7 @@ import { getCollection } from 'astro:content'; export async function GET() { - const posts = await getCollection('posts', ({ data }) => { - return import.meta.env.PROD ? data.draft !== true : true; -}); + const posts = await getCollection('posts'); const searchIndex = posts.map(post => ({ title: post.data.title, description: post.data.description || '', diff --git a/src/pages/tags.astro b/src/pages/tags.astro index 468f271..340f690 100644 --- a/src/pages/tags.astro +++ b/src/pages/tags.astro @@ -1,26 +1,17 @@ --- import {getCollection} from "astro:content"; import Layout from "../layouts/Layout.astro"; -const allPosts = await getCollection('posts', ({ data }) => { - return import.meta.env.PROD ? data.draft !== true : true; -}); +const allPosts = await getCollection('posts'); const uniqueTags = [...new Set(allPosts.map((post: any) => post.data.tags ? post.data.tags : []).flat())]; ---

~/blog/tags

- ls tags/ -
+ ls -l tags/ +
{uniqueTags.map((tag) => (

{tag}

))}
- diff --git a/src/pages/tags/[...tag].astro b/src/pages/tags/[...tag].astro index 865a49a..3b74126 100644 --- a/src/pages/tags/[...tag].astro +++ b/src/pages/tags/[...tag].astro @@ -4,9 +4,7 @@ import {getCollection} from "astro:content"; import ArticleList from "../../components/ArticleList.astro"; export async function getStaticPaths() { - const allPosts = await getCollection('posts', ({ data }) => { - return import.meta.env.PROD ? data.draft !== true : true; -}); + const allPosts = await getCollection('posts'); 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 9311550..6af2c49 100644 --- a/src/pages/twtxt.txt.js +++ b/src/pages/twtxt.txt.js @@ -1,9 +1,7 @@ import { getCollection } from 'astro:content'; export async function GET(context) { - const posts = await getCollection('posts', ({ data }) => { - return import.meta.env.PROD ? data.draft !== true : true; -}); + const posts = await getCollection('posts'); // 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 470a3c7..0c04586 100644 --- a/src/plugins/heatmapdata/local.js +++ b/src/plugins/heatmapdata/local.js @@ -1,9 +1,7 @@ import { getCollection, render } from 'astro:content'; async function fetchPostsData() { - const posts = await getCollection('posts', ({ data }) => { - return import.meta.env.PROD ? data.draft !== true : true; -}); + const posts = await getCollection('posts'); const entriesData = {}; for (const post of posts) {