You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***$plugin-pwa:** set current registration scope for service worker (close: [#1271](https://github.com/vuejs/vuepress/issues/1271)) ([#1302](https://github.com/vuejs/vuepress/issues/1302)) ([4b2b0f4](https://github.com/vuejs/vuepress/commit/4b2b0f4))
8
+
***$theme-default:** sidebar group item cannot contain empty children (close: [#1278](https://github.com/vuejs/vuepress/issues/1278)) ([5f1eb0e](https://github.com/vuejs/vuepress/commit/5f1eb0e))
9
+
10
+
11
+
### Features
12
+
13
+
***$core:** support global layout (close: [#1226](https://github.com/vuejs/vuepress/issues/1226)) ([c91f55a](https://github.com/vuejs/vuepress/commit/c91f55a))
14
+
15
+
From now on, users have the ability to use a custom global layout component via [siteConfig](https://vuepress.vuejs.org/miscellaneous/glossary.html#siteconfig) or [themeEntryFile](https://vuepress.vuejs.org/miscellaneous/glossary.html#themeentryfile):
16
+
17
+
```js
18
+
module.exports= {
19
+
globalLayout:'/path/to/your/global/vue/sfc'
20
+
}
21
+
```
22
+
23
+
Here is the [content of default global layout component](https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/app/components/GlobalLayout.vue), an example of setting global header and footer:
24
+
25
+
```vue
26
+
<template>
27
+
<div id="global-layout">
28
+
<header><h1>Header</h1></header>
29
+
<component :is="layout"/>
30
+
<footer><h1>Footer</h1></footer>
31
+
</div>
32
+
</template>
33
+
34
+
<script>
35
+
export default {
36
+
computed: {
37
+
layout () {
38
+
if (this.$page.path) {
39
+
if (this.$vuepress.isLayoutExists(this.$page.frontmatter.layout)) {
40
+
return this.$page.frontmatter.layout
41
+
}
42
+
return 'Layout'
43
+
}
44
+
return 'NotFound'
45
+
}
46
+
}
47
+
}
48
+
</script>
49
+
```
50
+
51
+
Also, you can follow the convention, directly create a component `.vuepress/components/GlobalLayout.vue` or `themePath/layouts/GlobalLayout.vue` without any config. the loading priority is as follows:
52
+
53
+
- siteConfig
54
+
- siteAgreement
55
+
- themeEntryFile
56
+
- themeAgreement
57
+
- default
58
+
59
+
***$theme-default:** disable search box via frontmatter (close: [#1287](https://github.com/vuejs/vuepress/issues/1287)) ([#1288](https://github.com/vuejs/vuepress/issues/1288)) ([54e9eb0](https://github.com/vuejs/vuepress/commit/54e9eb0))
0 commit comments