Skip to content

Commit 11415e2

Browse files
committed
feat: update ui & seo
1 parent e0b9aff commit 11415e2

14 files changed

+1118
-1611
lines changed

bin/micro-app-vuepress

+2-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ const yParser = require('yargs-parser');
77
const argv = yParser(process.argv.slice(2));
88
const path = require('path');
99

10-
const { tryRequire, logger } = require('@micro-app/shared-utils');
11-
const MicroAppCLI = tryRequire('@micro-app/cli');
12-
if (!MicroAppCLI) {
13-
logger.throw("Cannot find module '@micro-app/cli'!");
14-
}
15-
16-
const { service } = MicroAppCLI;
10+
const { createService } = require('@micro-app/cli');
11+
const service = createService(argv);
1712

1813
[ 'extends', 'commands' ].forEach(name => {
1914
service.registerPlugin({

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"moment": "^2.24.0",
7373
"remove-markdown": "^0.3.0",
7474
"rss": "^1.2.2",
75-
"svg-sprite-loader": "^4.2.1",
75+
"svg-sprite-loader": "^4.2.5",
7676
"svgo": "^1.3.2",
7777
"svgo-loader": "^2.2.1",
7878
"vuepress": "^1.4.0",

src/config/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ module.exports = {
66
serviceWorker: true,
77
// custom theme
88
theme: path.resolve(__dirname, '../../theme/index.js'),
9-
// custom ssr template
10-
ssrTemplate: path.resolve(__dirname, '../template/index.ssr.html'),
119
// themeConfig: {
1210
// // logo: '/logo.png',
1311
// lastUpdated: '上次编辑时间',

src/template/index.ssr.html

-22
This file was deleted.

theme/components/Categories.vue

+14-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export default {
7474
transition: all 0.3s;
7575
border-radius: $borderRadius;
7676
box-shadow: $boxShadow;
77-
// background-color: $backgroundColor;
7877
78+
// background-color: $backgroundColor;
7979
&:hover {
8080
transform: translateY(-0.1rem);
8181
}
@@ -103,20 +103,30 @@ export default {
103103
vertical-align: middle;
104104
display: inline-block;
105105
margin: 0.3rem;
106-
background-color: darken($accentColor, 60%);
106+
background: $backgroundColor;
107+
color: $textColor;
108+
border: solid 1px $borderColor;
107109
font-size: 13px;
108110
109111
a {
110112
padding: 0.3rem 0.6rem;
111113
}
112114
113-
.name {
114-
color: #fff;
115+
&:hover {
116+
background: $accentColor;
117+
118+
a {
119+
color: #fff;
120+
}
115121
}
116122
}
117123
118124
&[simple].active {
119125
background-color: $accentColor;
126+
127+
a {
128+
color: #fff;
129+
}
120130
}
121131
}
122132
}

theme/components/CategoriesCardBlocks.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default {
7171
7272
.title {
7373
position: relative;
74-
font-size: 1.28rem;
74+
font-size: 1.2rem;
7575
line-height: 36px;
7676
border: none;
7777
display: inline-block;
@@ -83,7 +83,7 @@ export default {
8383
position: absolute;
8484
right: 20px;
8585
top: 10px;
86-
color: $backgroundColor;
86+
color: $textColor;
8787
font-weight: bold;
8888
}
8989
}

theme/components/Header.vue

+13-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<div :class="[ $style.headerWrapper, heroImage ? $style.hasHeroImage : '' ]">
1212
<div v-if="heroImage" :class="$style.headerItem">
1313
<img
14+
:key="heroImage"
1415
:class="$style.logo"
1516
:src="$withBase(heroImage)"
1617
:alt="frontmatter.heroAlt || 'hero'"
@@ -26,7 +27,7 @@
2627
<span>{{ heroText }}</span>
2728
</h1>
2829

29-
<hr />
30+
<TitleLine />
3031

3132
<p v-if="frontmatter.tagline !== null" :class="$style.description">{{ tagline }}</p>
3233

@@ -63,9 +64,10 @@
6364

6465
<script>
6566
import NavLink from '@theme/components/NavLink.vue';
67+
import TitleLine from '@theme/components/TitleLine.vue';
6668
export default {
6769
name: 'Home',
68-
components: { NavLink },
70+
components: { NavLink, TitleLine },
6971
computed: {
7072
hasMask() {
7173
return this.$slots.mask || this.frontmatter.banner;
@@ -150,6 +152,14 @@ export default {
150152
align-items: center;
151153
display: flex;
152154
padding-top: 6rem;
155+
156+
&>span {
157+
padding: 0;
158+
}
159+
160+
hr {
161+
margin-left: 10px;
162+
}
153163
}
154164
155165
.headerItem {
@@ -168,11 +178,11 @@ export default {
168178
font-size: 2rem;
169179
170180
&>span {
171-
padding: 0.1rem 0.4rem 0.1rem 0.5rem;
172181
letter-spacing: 0.1rem;
173182
}
174183
175184
&[has-banner]>span {
185+
padding: 0.1rem 0.4rem 0.1rem 0.5rem;
176186
background: $accentColor;
177187
color: #fff;
178188
}

theme/components/PostCardBlocks.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default {
139139
margin: auto;
140140
display: flex;
141141
flex-wrap: wrap;
142-
justify-content: center;
142+
justify-content: space-between;
143143
144144
// column-count: 3;
145145
.cardItem {

theme/components/TagList.vue

+8-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default {
4444
if (this.simple) {
4545
return {};
4646
}
47-
return { backgroundColor: getOneColor(index) };
47+
return { };
4848
},
4949
},
5050
};
@@ -61,24 +61,28 @@ export default {
6161
display: inline-block;
6262
cursor: pointer;
6363
border-radius: $borderRadius;
64-
background: #fff;
65-
color: #fff;
64+
background: $backgroundColor;
65+
color: $textColor;
66+
border: solid 1px $borderColor;
6667
line-height: 13px;
6768
font-size: 13px;
6869
box-shadow: $boxShadow;
6970
transition: all 0.3s;
7071
7172
&:hover {
7273
transform: translateY(-0.1rem);
74+
background: $accentColor;
75+
color: #fff;
7376
}
7477
7578
&[simple] {
76-
background: darken($accentColor, 60%) !important;
7779
}
7880
7981
&[simple].active {
8082
background: $accentColor !important;
83+
color: #fff;
8184
}
8285
}
8386
}
8487
</style>
88+

theme/components/TitleLine.vue

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<template>
2+
<div :class="$style.root">
3+
<div :class="$style.line"></div>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'TitleLine',
10+
};
11+
</script>
12+
13+
<style lang="stylus" module>
14+
.root {
15+
position: relative;
16+
overflow: hidden;
17+
height: 1px;
18+
width: 24rem;
19+
box-sizing: border-box;
20+
margin: auto;
21+
}
22+
23+
.line {
24+
position: relative;
25+
width: 4rem;
26+
height: 100%;
27+
text-align: center;
28+
opacity: 0.6;
29+
margin: 0;
30+
border: 0;
31+
background: linear-gradient(90deg, rgba(24, 144, 255, 0) 0, $accentColor);
32+
transform: translateX(-100%);
33+
animation: pageLine 3s ease-in-out 1.5s infinite;
34+
}
35+
36+
@keyframes pageLine {
37+
0%, 25% {
38+
transform: translateX(-100%);
39+
}
40+
41+
75%, 100% {
42+
transform: translateX(600%);
43+
}
44+
}
45+
</style>

theme/plugins/config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const POWERBY_NAME = 'Micro-App';
2+
const RSS_FILENAME = 'rss.xml';
3+
4+
module.exports = {
5+
POWERBY_NAME,
6+
RSS_FILENAME,
7+
};

theme/plugins/rss.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// rss
2+
const { RSS_FILENAME } = require('./config');
3+
24
module.exports = (options, ctx) => {
35
const { fs, _, logger, path } = require('@micro-app/shared-utils');
46
const RSS = require('rss');
@@ -22,7 +24,7 @@ module.exports = (options, ctx) => {
2224
const feed = new RSS({
2325
title: siteConfig.title,
2426
description: siteConfig.description,
25-
feed_url: `${siteUrl}/rss.xml`,
27+
feed_url: `${siteUrl}/${RSS_FILENAME}`,
2628
site_url: siteUrl,
2729
copyright: copyright || author,
2830
language: 'en',

theme/plugins/seo/index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { POWERBY_NAME, RSS_FILENAME } = require('../config');
12
const moment = require('moment');
23

34
const defaultOptions = {
@@ -98,7 +99,7 @@ const defaultOptions = {
9899
if (blogConfig.rss) {
99100
add('alternate', 'rss', 'link', {
100101
rel: 'alternate', title: $page.localeConfig.title || $site.title,
101-
href: siteUrl + '/rss.xml',
102+
href: `${siteUrl}/${RSS_FILENAME}`,
102103
});
103104
}
104105

@@ -141,9 +142,10 @@ const defaultOptions = {
141142
add('keywords', ctx.keywords);
142143

143144
// description
144-
if (!$page.frontmatter.home) {
145-
add('description', ctx.description);
146-
}
145+
add('description', ctx.description);
146+
147+
// powerby
148+
add('powerby', POWERBY_NAME);
147149
},
148150
};
149151

0 commit comments

Comments
 (0)