feat(blog): 添加博客目录功能并更新logo格式
为博客和关于页面添加可交互的目录组件,方便用户导航 将网站logo从svg格式统一改为png格式 移除generateStaticParams函数以简化构建流程 新增getBlogDetail.ts用于获取博客详情数据
This commit is contained in:
23
lib/getBlogDetail.ts
Normal file
23
lib/getBlogDetail.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { BlogPost } from '@/types/blog';
|
||||
|
||||
export async function getPostDetail(articleId: string): Promise<BlogPost> {
|
||||
let url = 'http://49.232.154.205:18081/export/article/' + articleId
|
||||
|
||||
const response = await fetch(url);
|
||||
const json = await response.json();
|
||||
const data = json.data;
|
||||
const post = {
|
||||
locale: data.langCode,
|
||||
title: data.title,
|
||||
description: data.summary,
|
||||
image: data.cover || '',
|
||||
slug: data.articleId,
|
||||
tags: '',
|
||||
date: data.publishedTime,
|
||||
// visible: data.visible || 'published',
|
||||
pin: false,
|
||||
content: data.content,
|
||||
metadata: data,
|
||||
}
|
||||
return post;
|
||||
}
|
||||
Reference in New Issue
Block a user