Skip to content

Commit 4523d2b

Browse files
committed
chore: reorganize assets and set up manifests
1 parent a1f4598 commit 4523d2b

22 files changed

+118
-23
lines changed

docs/.vuepress/config.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,47 @@ import { navbar, sidebar } from './configs'
77
const config: UserConfig<DefaultThemeOptions> = {
88
base: '/',
99

10-
head: [['link', { rel: 'icon', href: `/logo.png` }]],
10+
head: [
11+
[
12+
'link',
13+
{
14+
rel: 'icon',
15+
type: 'image/png',
16+
sizes: '16x16',
17+
href: `/images/icons/favicon-16x16.png`,
18+
},
19+
],
20+
[
21+
'link',
22+
{
23+
rel: 'icon',
24+
type: 'image/png',
25+
sizes: '32x32',
26+
href: `/images/icons/favicon-32x32.png`,
27+
},
28+
],
29+
['link', { rel: 'manifest', href: '/manifest.webmanifest' }],
30+
['meta', { name: 'application-name', content: 'VuePress' }],
31+
['meta', { name: 'apple-mobile-web-app-title', content: 'VuePress' }],
32+
[
33+
'meta',
34+
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black' },
35+
],
36+
[
37+
'link',
38+
{ rel: 'apple-touch-icon', href: `/images/icons/apple-touch-icon.png` },
39+
],
40+
[
41+
'link',
42+
{
43+
rel: 'mask-icon',
44+
href: '/images/icons/safari-pinned-tab.svg',
45+
color: '#3eaf7c',
46+
},
47+
],
48+
['meta', { name: 'msapplication-TileColor', content: '#3eaf7c' }],
49+
['meta', { name: 'theme-color', content: '#3eaf7c' }],
50+
],
1151

1252
// site-level locales config
1353
locales: {
@@ -24,7 +64,7 @@ const config: UserConfig<DefaultThemeOptions> = {
2464
},
2565

2666
themeConfig: {
27-
logo: '/hero.png',
67+
logo: '/images/hero.png',
2868

2969
repo: 'vuepress/vuepress-next',
3070

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<browserconfig>
3+
<msapplication>
4+
<tile>
5+
<square150x150logo src="/images/icons/mstile-150x150.png"/>
6+
<TileColor>#ffffff</TileColor>
7+
</tile>
8+
</msapplication>
9+
</browserconfig>

docs/.vuepress/public/favicon.ico

14.7 KB
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 23 additions & 0 deletions
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "VuePress",
3+
"short_name": "VuePress",
4+
"description": "Vue-powered Static Site Generator",
5+
"start_url": "/index.html",
6+
"display": "standalone",
7+
"background_color": "#fff",
8+
"theme_color": "#3eaf7c",
9+
"icons": [
10+
{
11+
"src": "/images/icons/android-chrome-192x192.png",
12+
"sizes": "192x192",
13+
"type": "image/png"
14+
},
15+
{
16+
"src": "/images/icons/android-chrome-384x384.png",
17+
"sizes": "384x384",
18+
"type": "image/png"
19+
}
20+
]
21+
}

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
home: true
33
title: Home
4-
heroImage: /hero.png
4+
heroImage: /images/hero.png
55
actions:
66
- text: Get Started
77
link: /guide/getting-started.html

docs/guide/assets.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,23 @@ Take our documentation source files as an example, we are putting the logo of Vu
2828
└─ docs
2929
├─ .vuepress
3030
| └─ public
31-
| └─ hero.png # <- Logo file
31+
| └─ images
32+
| └─ hero.png # <- Logo file
3233
└─ guide
33-
└─ assets.md # <- Here we are
34+
└─ assets.md # <- Here we are
3435
```
3536

3637
We can reference our logo in current page like this:
3738

3839
**Input**
3940

4041
```md
41-
![VuePress Logo](/hero.png)
42+
![VuePress Logo](/images/hero.png)
4243
```
4344

4445
**Output**
4546

46-
![VuePress Logo](/hero.png)
47+
![VuePress Logo](/images/hero.png)
4748

4849
::: tip
4950
Config reference: [public](../reference/config.md#public)
@@ -56,15 +57,15 @@ If your site is deployed to a non-root URL, i.e. the [base](../reference/config.
5657
For example, if you plan to deploy your site to `https://foo.github.io/bar/`, then `base` should be set to `"/bar/"`, and you have to reference your public files in Markdown like this:
5758

5859
```md
59-
![VuePress Logo](/bar/hero.png)
60+
![VuePress Logo](/bar/images/hero.png)
6061
```
6162

6263
Obviously, it is brittle if you ever decide to change the `base`. This is the reason why we suggest to reference static assets using relative URLs.
6364

6465
To help with that, VuePress provides a built-in helper `$withBase` that generates the correct path:
6566

6667
```md
67-
<img :src="$withBase('/hero.png')" alt="VuePress Logo">
68+
<img :src="$withBase('/images/hero.png')" alt="VuePress Logo">
6869
```
6970

7071
The helper is verbose in Markdown. So it might be more helpful for theme and plugin authors.

docs/reference/config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ You can also specify the config file via `--config` option of [CLI](./cli.md).
104104

105105
```js
106106
module.exports = {
107-
head: [['link', { rel: 'icon', href: '/logo.png' }]],
107+
head: [['link', { rel: 'icon', href: '/images/logo.png' }]],
108108
}
109109
```
110110

111111
Rendered as:
112112

113113
```html
114114
<head>
115-
<link rel="icon" href="/logo.png" />
115+
<link rel="icon" href="/images/logo.png" />
116116
</head>
117117
```
118118

docs/reference/default-theme/frontmatter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Frontmatter in this section will only take effect in home pages.
3535
```md
3636
---
3737
# public file path
38-
heroImage: /hero.png
38+
heroImage: /images/hero.png
3939
# url
4040
heroImage: https://vuejs.org/images/logo.png
4141
---

docs/zh/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
home: true
33
title: 首页
4-
heroImage: /hero.png
4+
heroImage: /images/hero.png
55
actions:
66
- text: 快速上手
77
link: /zh/guide/getting-started.html

docs/zh/guide/assets.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,23 @@
2828
└─ docs
2929
├─ .vuepress
3030
| └─ public
31-
| └─ hero.png # <- Logo 文件
31+
| └─ images
32+
| └─ hero.png # <- Logo 文件
3233
└─ guide
33-
└─ assets.md # <- 我们在这里
34+
└─ assets.md # <- 我们在这里
3435
```
3536

3637
我们可以这样在当前页面引用 Logo :
3738

3839
**Input**
3940

4041
```md
41-
![VuePress Logo](/hero.png)
42+
![VuePress Logo](/images/hero.png)
4243
```
4344

4445
**Output**
4546

46-
![VuePress Logo](/hero.png)
47+
![VuePress Logo](/images/hero.png)
4748

4849
::: tip
4950
配置参考: [public](../reference/config.md#public)
@@ -56,15 +57,15 @@
5657
举例来说,如果你想要把网站部署到 `https://foo.github.io/bar/` ,那么应该把 `base` 设置为 `"/bar/"` ,此时你必须在 Markdown 文件中这样引用 Public 文件:
5758

5859
```md
59-
![VuePress Logo](/bar/hero.png)
60+
![VuePress Logo](/bar/images/hero.png)
6061
```
6162

6263
显然,一旦某一天你修改了 `base`,这样的路径引用将会显得异常脆弱。这也是我们推荐你使用相对路径来引用静态文件的原因。
6364

6465
为了解决这个问题,VuePress 提供了内置的一个 Helper `$withBase` ,它可以帮助你生成正确的路径:
6566

6667
```md
67-
<img :src="$withBase('/hero.png')" alt="VuePress Logo">
68+
<img :src="$withBase('/images/hero.png')" alt="VuePress Logo">
6869
```
6970

7071
在 Markdown 中使用这个 Helper 会显得有些冗长,因此它可能对主题和插件作者更有帮助。

docs/zh/reference/config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ VuePress 配置的参考文档,可以通过配置文件来设置这些配置
103103

104104
```js
105105
module.exports = {
106-
head: [['link', { rel: 'icon', href: '/logo.png' }]],
106+
head: [['link', { rel: 'icon', href: '/images/logo.png' }]],
107107
}
108108
```
109109

110110
渲染为:
111111

112112
```html
113113
<head>
114-
<link rel="icon" href="/logo.png" />
114+
<link rel="icon" href="/images/logo.png" />
115115
</head>
116116
```
117117

docs/zh/reference/default-theme/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ module.exports = {
118118
module.exports = {
119119
themeConfig: {
120120
// Public 文件路径
121-
logo: '/hero.png',
121+
logo: '/images/hero.png',
122122
// URL
123123
logo: 'https://vuejs.org/images/logo.png',
124124
},

docs/zh/reference/default-theme/frontmatter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
```md
3636
---
3737
# Public 文件路径
38-
heroImage: /hero.png
38+
heroImage: /images/hero.png
3939
# URL
4040
heroImage: https://vuejs.org/images/logo.png
4141
---

0 commit comments

Comments
 (0)