Skip to content

Commit

Permalink
feat: page updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdayo committed May 7, 2024
1 parent 6120d5c commit fc8fced
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 42,8 @@ export default defineConfigWithTheme<ThemeConfig>({
ignoreDeadLinks: 'localhostLinks',

themeConfig: {
logo: 'https://avatars.githubusercontent.com/u/41754841',

taglines: [
'<code>(() => &lt;bs moe/&gt;)()</code>',
"<code>h('bs', { moe: true })</code>",
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 10,7 @@
</div>
</template>

<template #doc-after>
<template #doc-after v-if="page.frontmatter.comment ?? true">
<div class="VPDoc vp-doc">
<h2 id="giscus">评论</h2>
</div>
Expand Down
11 changes: 11 additions & 0 deletions .vitepress/theme/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 28,11 @@ $custom-blocks: (
--vp-c-brand-3: #1565c0;
}

// 移动端目录菜单
.outline {
outline-color: var(--vp-c-divider);
}

@each $name, $color in $custom-blocks {
:root {
--vp-custom-block-#{$name}-border: #{$color};
Expand Down Expand Up @@ -61,6 66,12 @@ $custom-blocks: (
margin-top: 8px;
}

// 导航栏的 Logo
img.VPImage.logo {
border-radius: 50%;
}

// 主页 Logo
.VPHero .image-container {
@media (min-width: 960px) {
transform: none;
Expand Down
1 change: 0 additions & 1 deletion pages/about/index.md
Original file line number Diff line number Diff line change
@@ -1,5 1,4 @@
---
title: 关于
comment: true
---

Expand Down
1 change: 0 additions & 1 deletion pages/links/index.md
Original file line number Diff line number Diff line change
@@ -1,5 1,4 @@
---
title: 友情链接
comment: true

links:
Expand Down
20 changes: 16 additions & 4 deletions pages/posts/PostList.vue
Original file line number Diff line number Diff line change
@@ -1,7 1,8 @@
<template>
<div class="my-4">
<div v-for="year in years" :key="year.year">
<h2 :id="year.year.toString()">{{ year.year }}</h2>
<div
v-for="post in posts"
v-for="post in year.posts"
:key="post.id"
class="pa-4 not-last:border-b not-last:border-b-input not-last:border-b-solid"
>
Expand All @@ -21,8 22,19 @@

<script lang="ts" setup>
import { useData } from 'vitepress'
import { data as posts } from '../../.vitepress/posts.data'
// import { Badge } from '@/components/ui/badge'
import { data as posts } from '@/.vitepress/posts.data'
import type { Post } from '@/.vitepress/theme'
const years: { year: number; posts: Post[] }[] = []
for (const post of posts) {
const year = new Date(post.create).getFullYear()
let yearData = years.find((y) => y.year === year)
if (!yearData) {
yearData = { year, posts: [] }
years.push(yearData)
}
yearData.posts.push(post)
}
const { site } = useData()
Expand Down
4 changes: 3 additions & 1 deletion pages/posts/index.md
Original file line number Diff line number Diff line change
@@ -1,7 1,9 @@
---
layout: page
comment: false
---

# 文章

<div class="mx-auto max-w-768px">
<PostList />
</div>
Expand Down

0 comments on commit fc8fced

Please sign in to comment.