-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(blog): create blog part (#284)
Create blog part for publishing blog posts, still WIP. - [x] Basic Post List - [x] CSS Style - [x] add to nav bar - [x] add contributing guide - [ ] auto close sidebar (help needed)
- Loading branch information
Showing
9 changed files
with
174 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { createContentLoader } from "vitepress" | ||
|
||
interface Post { | ||
title: string | ||
url: string | ||
date: string | ||
excerpt: string | undefined | ||
} | ||
declare const data: Post[] | ||
export { data } | ||
|
||
export default createContentLoader("blog/!(?|index).md", { | ||
// Options | ||
excerpt: true, | ||
transform(raw): Post[] { | ||
return raw.map(({ url, frontmatter, excerpt }) => ({ | ||
title: frontmatter.title, | ||
url, | ||
date: frontmatter.date, | ||
excerpt, | ||
})) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<script lang="ts" setup> | ||
import { data as posts } from "../../data/posts.data" | ||
</script> | ||
|
||
<template> | ||
<div class="container"> | ||
<div v-for="post in posts" :key="post.url"> | ||
<a style="color: inherit;" class="card" :href="post.url"> | ||
<span class="title">{{ post.title }}</span> | ||
<div class="content" v-if="post.excerpt" v-html="post.excerpt"></div> | ||
</a> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.container { | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
max-width: 1200px; | ||
flex-wrap: wrap; | ||
z-index: 1; | ||
} | ||
.container .card { | ||
position: relative; | ||
width: 15rem; | ||
height: 10rem; | ||
margin: 30px; | ||
box-shadow: 20px 20px 50px rgba(0, 0, 0, 0.5); | ||
border-radius: 15px; | ||
background: rgba(255, 255, 255, 0.1); | ||
overflow: hidden; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
border-top: 1px solid rgba(255, 255, 255, 0.5); | ||
border-left: 1px solid rgba(255, 255, 255, 0.5); | ||
backdrop-filter: blur(5px); | ||
} | ||
.container .card .title { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
opacity: 1; | ||
transition: opacity 0.3s ease-out; | ||
} | ||
.container .card:hover .title { | ||
opacity: 0; | ||
} | ||
.container .card .content { | ||
padding: 10px; | ||
text-align: center; | ||
transform: translateY(100px); | ||
opacity: 0; | ||
transition: 0.5s; | ||
} | ||
.container .card:hover .content { | ||
transform: translateY(0px) scale(0.8); | ||
opacity: 1; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
sidebar: false | ||
--- | ||
|
||
# 博客板块 | ||
|
||
本板块包含了 GlobeMC 团队的一些博客文章,有助于提升读者的 Debug 能力,有兴趣的读者可以关注一下。 | ||
|
||
--- | ||
|
||
<Posts /> | ||
|
||
--- | ||
|
||
# 贡献提醒 | ||
|
||
欢迎大家参与到 GlobeMC 团队的博客文章的编写中来,博客文章的排版规范以本文档排版规范为准。 | ||
|
||
Frontmatter 格式如下: | ||
|
||
```markdown | ||
--- | ||
sidebar: false | ||
title: 文章标题 | ||
date: 2024-06-22 19:11:00 | ||
--- | ||
``` | ||
|
||
出现在第一个 `---` (不包括 frontmatter)之前的部分为文章摘要,将显示在文章列表卡片中。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
sidebar: false | ||
title: Post1 | ||
date: 2021-01-01T00:00:00Z | ||
--- | ||
|
||
# Post1 | ||
|
||
Some text here. | ||
Write excerpts here, before the first `---` line. | ||
|
||
--- | ||
|
||
This is the end of the first post. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
sidebar: false | ||
title: A vert lone title to test the display style | ||
date: 2021-01-01 00:00:00 | ||
--- | ||
|
||
# Post 2 | ||
|
||
some content here | ||
|
||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters