mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
feat: hide posts in Prod with future pubDatetime (#234)
* Hide posts when PubDateTime is not reached * refactor: extract filter logic into a file * docs: update SITE config docs --------- Co-authored-by: satnaing <satnaingdev@gmail.com>
This commit is contained in:
@@ -6,12 +6,14 @@ import Main from "@layouts/Main.astro";
|
||||
import Header from "@components/Header.astro";
|
||||
import Footer from "@components/Footer.astro";
|
||||
import SearchBar from "@components/Search";
|
||||
import getSortedPosts from "@utils/getSortedPosts";
|
||||
|
||||
// Retrieve all articles
|
||||
// Retrieve all published articles
|
||||
const posts = await getCollection("blog", ({ data }) => !data.draft);
|
||||
const sortedPosts = getSortedPosts(posts);
|
||||
|
||||
// List of items to search in
|
||||
const searchList = posts.map(({ data, slug }) => ({
|
||||
const searchList = sortedPosts.map(({ data, slug }) => ({
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
data,
|
||||
|
||||
Reference in New Issue
Block a user