添加分页、blog article、deprecated feature
2025-05-29
Written by: tdtc
Also see 使用hugo在gitee上写blog
拷贝blog(src/pages/blog)中的文件:
[page].astro
index.astro
修改index.astro:
import BlogPost from '../../components/BlogPost.astro';
import BaseLayout from '../../layouts/BaseLayout.astro';
import BlogPost from '../components/BlogPost.astro';
import BaseLayout from '../layouts/BaseLayout.astro';
astro.config.mjs
site: "https://tdtc-hrb.github.io",
base: "ops-win",
[page].astro
<a href="/blog">First</a>
Replace with
<a href={baseUrl} >First</a>
<a href="/blog/2">Next</a>
Replace with
<a href={baseUrl + '/page/2'} >First</a>
[page].astro
return paginate(all, { pageSize: 8 });
const allPosts = (Object.values(import.meta.glob('../../pages/posts/*.md', { eager: true }))).slice(
0,
8
);
await Astro.glob('../../pages/posts/*.md');
instead of
Object.values(import.meta.glob('../pages/posts/*.md', { eager: true }))
[page].astro
await Astro.glob('../../pages/posts/*.md');
instead of
Object.values(import.meta.glob('../../pages/posts/*.md', { eager: true }));
npm install
npm run build
npm run preview