-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
44 changed files
with
1,185 additions
and
345 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
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,46 @@ | ||
<script setup lang="ts"> | ||
import { data as posts } from './blog.data' | ||
function getDateTime(time: number) { | ||
return new Date(time).toISOString() | ||
} | ||
</script> | ||
|
||
<template> | ||
<ul class="blog-list"> | ||
<li class="blog-entry" v-for="post of posts"> | ||
<article> | ||
<time :datetime="getDateTime(post.date.time)">{{ | ||
post.date.string | ||
}}</time> | ||
<h2 class="title"> | ||
<a :href="post.url">{{ post.title }}</a> | ||
</h2> | ||
</article> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<style scoped> | ||
.blog-list { | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
.blog-entry { | ||
margin-top: 3em; | ||
border-bottom: 1px solid var(--vp-c-divider); | ||
} | ||
.blog-entry time { | ||
font-size: 14px; | ||
} | ||
.title { | ||
border: none; | ||
margin-top: 0; | ||
padding-top: 0; | ||
font-size: 22px; | ||
} | ||
.title a { | ||
font-weight: 600; | ||
text-decoration: none; | ||
} | ||
</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,40 @@ | ||
import { createContentLoader } from 'vitepress' | ||
|
||
interface Post { | ||
title: string | ||
url: string | ||
date: { | ||
time: number | ||
string: string | ||
} | ||
} | ||
|
||
declare const data: Post[] | ||
export { data } | ||
|
||
export default createContentLoader('blog/*.md', { | ||
// excerpt: true, | ||
transform(raw): Post[] { | ||
return raw | ||
.map(({ url, frontmatter }) => ({ | ||
title: frontmatter.head.find((e) => e[1].property === 'og:title')[1] | ||
.content, | ||
url, | ||
date: formatDate(frontmatter.date), | ||
})) | ||
.sort((a, b) => b.date.time - a.date.time) | ||
}, | ||
}) | ||
|
||
function formatDate(raw: string): Post['date'] { | ||
const date = new Date(raw) | ||
date.setUTCHours(12) | ||
return { | ||
time: +date, | ||
string: date.toLocaleDateString('en-US', { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric', | ||
}), | ||
} | ||
} |
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 |
---|---|---|
@@ -1,22 +1,27 @@ | ||
import { h } from 'vue' | ||
import Theme from 'vitepress/theme' | ||
import type { Theme } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
import './styles/vars.css' | ||
import HomeSponsors from './components/HomeSponsors.vue' | ||
import AsideSponsors from './components/AsideSponsors.vue' | ||
import SvgImage from './components/SvgImage.vue' | ||
import WwAds from './components/WwAds.vue' | ||
import './styles/vars.css' | ||
import './custom.css' | ||
// temporary fix for vitepress not including component css when only | ||
// imported in a single page | ||
import './components/BlogIndex.vue' | ||
|
||
export default { | ||
...Theme, | ||
extends: DefaultTheme, | ||
Layout() { | ||
return h(Theme.Layout, null, { | ||
return h(DefaultTheme.Layout, null, { | ||
'home-features-after': () => h(HomeSponsors), | ||
'aside-outline-after': () => h(WwAds), | ||
'aside-bottom': () => h(AsideSponsors) | ||
}) | ||
}, | ||
enhanceApp({ app }) { | ||
app.component('SvgImage', SvgImage) | ||
} | ||
} | ||
}, | ||
} satisfies Theme | ||
|
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
Oops, something went wrong.
7942efa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
cn-vitejs-dev – ./
docs-cn.vercel.app
cn-vitejs-dev-vuejs.vercel.app
cn-vitejs-dev-git-main-vuejs.vercel.app
cn.vitejs.dev