mirror of
https://github.com/Xevion/undefined.behavio.rs.git
synced 2025-12-15 18:13:37 -06:00
Factor filter predicate into helpers.ts, add @lib alias dir
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import { shouldShowPost } from "@lib/helpers";
|
||||
import General from "@layouts/General.astro";
|
||||
import Summary from "@components/Summary.astro";
|
||||
const posts = (await getCollection("blog")).filter(entry => import.meta.env.DEV || !entry.data.draft);
|
||||
const posts = (await getCollection("blog")).filter(shouldShowPost);
|
||||
posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime());
|
||||
---
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
import Post from "@layouts/Post.astro";
|
||||
import { shouldShowPost } from "@lib/helpers";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection("blog");
|
||||
return posts
|
||||
.filter((entry) => import.meta.env.DEV || !entry.data.draft)
|
||||
.filter(shouldShowPost)
|
||||
.map((entry) => {
|
||||
return {
|
||||
params: { slug: entry.slug },
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
---
|
||||
import General from "@layouts/General.astro";
|
||||
import { shouldShowPost } from "@lib/helpers";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const blogEntries = await getCollection("blog");
|
||||
const tags = new Set(
|
||||
blogEntries
|
||||
.filter((entry) => import.meta.env.DEV || !entry.data.draft)
|
||||
.filter(shouldShowPost)
|
||||
.map((entry) => entry.data.tags)
|
||||
.flat(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user