Add Pagefind search, sort posts by update time, link DigiKedai bot repo
Deploy / build (push) Successful in 20s

This commit is contained in:
hoelee committed 2026-09-06 07:31:02 +08:00
1 parent dfd9612a6b
commit 93c716f876
12 files changed
+369 -13

No files matched your search

+4 -3
View File
@@ -3,6 +3,7 @@ import BaseLayout from '../../layouts/BaseLayout.astro';
import PostList from '../../components/PostList.astro';
import { getCollection } from 'astro:content';
import { isEn } from '../../lib/lang';
import { sortByUpdated } from '../../lib/sort';
export async function getStaticPaths() {
const posts = await getCollection('posts', isEn);
@@ -12,9 +13,9 @@ export async function getStaticPaths() {
const { category } = Astro.params;
const posts = (await getCollection('posts', isEn))
.filter((p) => p.data.category === category)
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
const posts = sortByUpdated(
(await getCollection('posts', isEn)).filter((p) => p.data.category === category),
);
---
<BaseLayout title={`${category} — Mr Hoelee`} description={`Posts in the ${category} category.`}>
+2 -2
View File
@@ -4,9 +4,9 @@ import PostList from '../components/PostList.astro';
import { getCollection } from 'astro:content';
import { isEn } from '../lib/lang';
import { SITE } from '../config';
import { sortByUpdated } from '../lib/sort';
const posts = (await getCollection('posts', isEn))
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
const posts = sortByUpdated(await getCollection('posts', isEn));
---
<BaseLayout title={SITE.title} description={SITE.description}>
+2 -2
View File
@@ -3,9 +3,9 @@ import BaseLayout from '../../layouts/BaseLayout.astro';
import PostList from '../../components/PostList.astro';
import { getCollection } from 'astro:content';
import { isEn } from '../../lib/lang';
import { sortByUpdated } from '../../lib/sort';
const posts = (await getCollection('posts', isEn))
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
const posts = sortByUpdated(await getCollection('posts', isEn));
---
<BaseLayout title="Posts — Mr Hoelee" description="All posts on Mr Hoelee's blog.">
+2 -2
View File
@@ -4,9 +4,9 @@ import PostList from '../../components/PostList.astro';
import { getCollection } from 'astro:content';
import { isZh } from '../../lib/lang';
import { SITE } from '../../config';
import { sortByUpdated } from '../../lib/sort';
const posts = (await getCollection('posts', isZh))
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
const posts = sortByUpdated(await getCollection('posts', isZh));
---
<BaseLayout