File tree 2 files changed +14
-3
lines changed
packages/@vuepress/plugin-blog
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change
1
+ const path = require ( 'path' )
2
+
1
3
module . exports = ( options , ctx ) => ( {
2
4
extendPageData ( pageCtx ) {
3
5
const {
@@ -16,15 +18,24 @@ module.exports = (options, ctx) => ({
16
18
const isLayoutExists = name => layoutComponentMap [ name ] !== undefined
17
19
const getLayout = name => isLayoutExists ( name ) ? name : 'Layout'
18
20
21
+ const isDirectChild = regularPath => path . parse ( regularPath ) . dir === '/'
19
22
const enhancers = [
20
23
{
21
- when : ( { regularPath } ) => regularPath === '/category/' ,
24
+ when : ( { regularPath } ) => isDirectChild ( regularPath ) ,
25
+ frontmatter : { layout : getLayout ( 'Page' ) }
26
+ } ,
27
+ {
28
+ when : ( { regularPath } ) => regularPath === '/category.html' ,
22
29
frontmatter : { layout : getLayout ( 'Category' ) }
23
30
} ,
24
31
{
25
- when : ( { regularPath } ) => regularPath === '/tags/ ' ,
32
+ when : ( { regularPath } ) => regularPath === '/tags.html ' ,
26
33
frontmatter : { layout : getLayout ( 'Tag' ) }
27
34
} ,
35
+ {
36
+ when : ( { regularPath } ) => regularPath === '/' ,
37
+ frontmatter : { layout : getLayout ( 'Layout' ) }
38
+ } ,
28
39
{
29
40
when : ( { regularPath } ) => regularPath . startsWith ( '/_posts/' ) ,
30
41
frontmatter : {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @vuepress/plugin-blog" ,
3
3
"version" : " 1.0.0" ,
4
- "description" : " theme plugin for vuepress" ,
4
+ "description" : " blog plugin for vuepress" ,
5
5
"main" : " index.js" ,
6
6
"publishConfig" : {
7
7
"access" : " public"
You can’t perform that action at this time.
0 commit comments