Skip to content

Commit

Permalink
🦄 refactor: 优化配置
Browse files Browse the repository at this point in the history
  • Loading branch information
tansincosy committed Aug 27, 2022
1 parent d67eefb commit 49b5a12
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 博客配置
BLOG_TITLE = "sample"
BLOG_SUBTITLE = "subtitle"
BLOG_THUMBNAIL = "/imgs/index.jpg"
NEXT_PUBLIC_BLOG_TITLE = "sample"
NEXT_PUBLIC_BLOG_SUBTITLE = "subtitle"
NEXT_PUBLIC_BLOG_THUMBNAIL = "/imgs/index.jpg"

# 评论仓库地址
NEXT_PUBLIC_COMMENT_REPO_NAME = tansincosy/Blog-Comment
Expand Down
5 changes: 4 additions & 1 deletion src/components/common/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export const Layout = ({

return (
<div className="absolute flex left-0 right-0 bottom-0 top-0 flex-col">
<TopAppBar category={category} appTitle={"BlogKit"} />
<TopAppBar
category={category}
appTitle={process.env.NEXT_PUBLIC_BLOG_TITLE}
/>
<section className="bg-background flex-1 pb-20 box-border">
{children}
</section>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ export const getStaticProps: GetStaticProps<
}
);
const profile = {
title: process.env.BLOG_TITLE || "",
subtitle: process.env.BLOG_SUBTITLE || "",
thumbnail: process.env.BLOG_THUMBNAIL || "",
title: process.env.NEXT_PUBLIC_BLOG_TITLE || "",
subtitle: process.env.NEXT_PUBLIC_BLOG_SUBTITLE || "",
thumbnail: process.env.NEXT_PUBLIC_BLOG_THUMBNAIL || "",
};
const category = await getCategoryPosts();
const imagePath = getActuallyImagePath(profile.thumbnail);
Expand Down

0 comments on commit 49b5a12

Please sign in to comment.