mirror of
https://github.com/YouHaveTrouble/youhavetrouble.github.io.git
synced 2026-05-11 22:06:56 +00:00
blog doesn't have to have any posts
This commit is contained in:
@@ -4,7 +4,12 @@ import Bio from '../../components/Bio.astro';
|
|||||||
import getPostData from '../../utils/getPostData';
|
import getPostData from '../../utils/getPostData';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await Astro.glob('../../data/blog-posts/*.md');
|
let posts = [];
|
||||||
|
try {
|
||||||
|
posts = await Astro.glob('../../data/blog-posts/*.md');
|
||||||
|
} catch (error) {
|
||||||
|
console.error("No blog posts found");
|
||||||
|
}
|
||||||
return posts.map(p => ({
|
return posts.map(p => ({
|
||||||
params: { slug: p.file.split('/').pop().split('.').shift() },
|
params: { slug: p.file.split('/').pop().split('.').shift() },
|
||||||
props: { post: p },
|
props: { post: p },
|
||||||
|
|||||||
Reference in New Issue
Block a user