Skip to content

Commit 1c5f852

Browse files
committed
first commit
0 parents  commit 1c5f852

File tree

5,111 files changed

+1114262
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,111 files changed

+1114262
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
name: Deploy Docs
3+
4+
on:
5+
push:
6+
branches:
7+
# make sure this is the branch you are using
8+
- main
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
deploy-gh-pages:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
# if your docs needs submodules, uncomment the following line
22+
# submodules: true
23+
24+
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 20
30+
cache: npm
31+
32+
- name: Install Deps
33+
run: npm ci
34+
35+
- name: Build Docs
36+
env:
37+
NODE_OPTIONS: --max_old_space_size=8192
38+
run: |-
39+
npm run docs:build
40+
> docs/.vuepress/dist/.nojekyll
41+
42+
- name: Deploy Docs
43+
uses: JamesIves/github-pages-deploy-action@v4
44+
with:
45+
# This is the branch where the docs are deployed to
46+
branch: gh-pages
47+
folder: docs/.vuepress/dist
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineClientConfig } from 'vuepress/client'
2+
import Article from './layouts/Article.vue'
3+
import Category from './layouts/Category.vue'
4+
import Tag from './layouts/Tag.vue'
5+
import Timeline from './layouts/Timeline.vue'
6+
7+
export default defineClientConfig({
8+
// we provide some blog layouts
9+
layouts: {
10+
Article,
11+
Category,
12+
Tag,
13+
Timeline,
14+
},
15+
})
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<script setup>
2+
defineProps({
3+
/** Article items */
4+
items: {
5+
type: Array,
6+
required: true,
7+
},
8+
/** Whether is timeline or not */
9+
isTimeline: Boolean,
10+
})
11+
</script>
12+
13+
<template>
14+
<div class="article-wrapper">
15+
<div v-if="!items.length">Nothing in here.</div>
16+
17+
<article
18+
v-for="{ info, path } in items"
19+
:key="path"
20+
class="article"
21+
@click="$router.push(path)"
22+
>
23+
<header class="title">
24+
{{
25+
(isTimeline ? `${new Date(info.date).toLocaleDateString()}: ` : '') +
26+
info.title
27+
}}
28+
</header>
29+
30+
<hr />
31+
32+
<div class="article-info">
33+
<span v-if="info.author" class="author">Author: {{ info.author }}</span>
34+
35+
<span v-if="info.date && !isTimeline" class="date"
36+
>Date: {{ new Date(info.date).toLocaleDateString() }}</span
37+
>
38+
39+
<span v-if="info.category" class="category"
40+
>Category: {{ info.category.join(', ') }}</span
41+
>
42+
43+
<span v-if="info.tag" class="tag">Tag: {{ info.tag.join(', ') }}</span>
44+
</div>
45+
46+
<div v-if="info.excerpt" class="excerpt" v-html="info.excerpt" />
47+
</article>
48+
</div>
49+
</template>
50+
51+
<style lang="scss">
52+
@use '@vuepress/theme-default/styles/mixins';
53+
54+
.article-wrapper {
55+
@include mixins.content_wrapper;
56+
text-align: center;
57+
}
58+
59+
.article {
60+
position: relative;
61+
62+
box-sizing: border-box;
63+
64+
width: 100%;
65+
margin: 0 auto 1.25rem;
66+
padding: 1rem 1.25rem;
67+
border: 1px solid var(--c-border);
68+
border-radius: 0.4rem;
69+
color: var(--c-text);
70+
71+
text-align: start;
72+
73+
@media (max-width: 419px) {
74+
border-radius: 0;
75+
}
76+
77+
&:hover {
78+
cursor: pointer;
79+
}
80+
81+
.title {
82+
position: relative;
83+
84+
display: inline-block;
85+
86+
font-size: 1.28rem;
87+
line-height: 2rem;
88+
89+
&::after {
90+
content: '';
91+
92+
position: absolute;
93+
bottom: 0;
94+
inset-inline-start: 0;
95+
96+
width: 100%;
97+
height: 2px;
98+
99+
background: var(--c-brand);
100+
101+
visibility: hidden;
102+
103+
transition: transform 0.3s ease-in-out;
104+
transform: scaleX(0);
105+
}
106+
107+
&:hover {
108+
&::after {
109+
visibility: visible;
110+
transform: scaleX(1);
111+
}
112+
}
113+
114+
a {
115+
color: inherit;
116+
}
117+
}
118+
119+
.article-info {
120+
display: flex;
121+
flex-shrink: 0;
122+
123+
> span {
124+
margin-inline-end: 0.5em;
125+
line-height: 1.8;
126+
}
127+
}
128+
129+
.excerpt {
130+
h1 {
131+
display: none;
132+
}
133+
134+
h2 {
135+
font-size: 1.2em;
136+
}
137+
138+
h3 {
139+
font-size: 1.15em;
140+
}
141+
}
142+
}
143+
</style>
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
import { blogPlugin } from '@vuepress/plugin-blog'
2+
import { defaultTheme } from '@vuepress/theme-default'
3+
import { defineUserConfig } from 'vuepress'
4+
import { viteBundler } from '@vuepress/bundler-vite'
5+
6+
export default defineUserConfig({
7+
lang: 'en-US',
8+
9+
title: 'VuePress',
10+
description: 'My first VuePress Site',
11+
12+
theme: defaultTheme({
13+
logo: 'https://vuejs.press/images/hero.png',
14+
15+
navbar: [
16+
'/',
17+
{
18+
text: 'Article',
19+
link: '/article/',
20+
},
21+
{
22+
text: 'Category',
23+
link: '/category/',
24+
},
25+
{
26+
text: 'Tag',
27+
link: '/tag/',
28+
},
29+
{
30+
text: 'Timeline',
31+
link: '/timeline/',
32+
},
33+
],
34+
}),
35+
36+
plugins: [
37+
blogPlugin({
38+
// Only files under posts are articles
39+
filter: ({ filePathRelative }) =>
40+
filePathRelative ? filePathRelative.startsWith('posts/') : false,
41+
42+
// Getting article info
43+
getInfo: ({ frontmatter, title, data }) => ({
44+
title,
45+
author: frontmatter.author || '',
46+
date: frontmatter.date || null,
47+
category: frontmatter.category || [],
48+
tag: frontmatter.tag || [],
49+
excerpt:
50+
// Support manually set excerpt through frontmatter
51+
typeof frontmatter.excerpt === 'string'
52+
? frontmatter.excerpt
53+
: data?.excerpt || '',
54+
}),
55+
56+
// Generate excerpt for all pages excerpt those users choose to disable
57+
excerptFilter: ({ frontmatter }) =>
58+
!frontmatter.home &&
59+
frontmatter.excerpt !== false &&
60+
typeof frontmatter.excerpt !== 'string',
61+
62+
category: [
63+
{
64+
key: 'category',
65+
getter: (page) => page.frontmatter.category || [],
66+
layout: 'Category',
67+
itemLayout: 'Category',
68+
frontmatter: () => ({
69+
title: 'Categories',
70+
sidebar: false,
71+
}),
72+
itemFrontmatter: (name) => ({
73+
title: `Category ${name}`,
74+
sidebar: false,
75+
}),
76+
},
77+
{
78+
key: 'tag',
79+
getter: (page) => page.frontmatter.tag || [],
80+
layout: 'Tag',
81+
itemLayout: 'Tag',
82+
frontmatter: () => ({
83+
title: 'Tags',
84+
sidebar: false,
85+
}),
86+
itemFrontmatter: (name) => ({
87+
title: `Tag ${name}`,
88+
sidebar: false,
89+
}),
90+
},
91+
],
92+
93+
type: [
94+
{
95+
key: 'article',
96+
// Remove archive articles
97+
filter: (page) => !page.frontmatter.archive,
98+
layout: 'Article',
99+
frontmatter: () => ({
100+
title: 'Articles',
101+
sidebar: false,
102+
}),
103+
// Sort pages with time and sticky
104+
sorter: (pageA, pageB) => {
105+
if (pageA.frontmatter.sticky && pageB.frontmatter.sticky)
106+
return pageB.frontmatter.sticky - pageA.frontmatter.sticky
107+
108+
if (pageA.frontmatter.sticky && !pageB.frontmatter.sticky) return -1
109+
110+
if (!pageA.frontmatter.sticky && pageB.frontmatter.sticky) return 1
111+
112+
if (!pageB.frontmatter.date) return 1
113+
if (!pageA.frontmatter.date) return -1
114+
115+
return (
116+
new Date(pageB.frontmatter.date).getTime() -
117+
new Date(pageA.frontmatter.date).getTime()
118+
)
119+
},
120+
},
121+
{
122+
key: 'timeline',
123+
// Only article with date should be added to timeline
124+
filter: (page) => page.frontmatter.date instanceof Date,
125+
// Sort pages with time
126+
sorter: (pageA, pageB) =>
127+
new Date(pageB.frontmatter.date).getTime() -
128+
new Date(pageA.frontmatter.date).getTime(),
129+
layout: 'Timeline',
130+
frontmatter: () => ({
131+
title: 'Timeline',
132+
sidebar: false,
133+
}),
134+
},
135+
],
136+
hotReload: true,
137+
}),
138+
],
139+
140+
bundler: viteBundler(),
141+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup>
2+
import { useBlogType } from '@vuepress/plugin-blog/client'
3+
import ParentLayout from '@vuepress/theme-default/layouts/Layout.vue'
4+
import ArticleList from '../components/ArticleList.vue'
5+
6+
const articles = useBlogType('article')
7+
</script>
8+
9+
<template>
10+
<ParentLayout>
11+
<template #page>
12+
<main class="page">
13+
<ArticleList :items="articles.items" />
14+
</main>
15+
</template>
16+
</ParentLayout>
17+
</template>

0 commit comments

Comments
 (0)