File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
packages/@vuepress/plugin-blog Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1+ const path = require ( 'path' )
2+
13module . exports = ( options , ctx ) => ( {
24 extendPageData ( pageCtx ) {
35 const {
@@ -16,15 +18,24 @@ module.exports = (options, ctx) => ({
1618 const isLayoutExists = name => layoutComponentMap [ name ] !== undefined
1719 const getLayout = name => isLayoutExists ( name ) ? name : 'Layout'
1820
21+ const isDirectChild = regularPath => path . parse ( regularPath ) . dir === '/'
1922 const enhancers = [
2023 {
21- when : ( { regularPath } ) => regularPath === '/category/' ,
24+ when : ( { regularPath } ) => isDirectChild ( regularPath ) ,
25+ frontmatter : { layout : getLayout ( 'Page' ) }
26+ } ,
27+ {
28+ when : ( { regularPath } ) => regularPath === '/category.html' ,
2229 frontmatter : { layout : getLayout ( 'Category' ) }
2330 } ,
2431 {
25- when : ( { regularPath } ) => regularPath === '/tags/ ' ,
32+ when : ( { regularPath } ) => regularPath === '/tags.html ' ,
2633 frontmatter : { layout : getLayout ( 'Tag' ) }
2734 } ,
35+ {
36+ when : ( { regularPath } ) => regularPath === '/' ,
37+ frontmatter : { layout : getLayout ( 'Layout' ) }
38+ } ,
2839 {
2940 when : ( { regularPath } ) => regularPath . startsWith ( '/_posts/' ) ,
3041 frontmatter : {
Original file line number Diff line number Diff line change 11{
22 "name" : " @vuepress/plugin-blog" ,
33 "version" : " 1.0.0" ,
4- "description" : " theme plugin for vuepress" ,
4+ "description" : " blog plugin for vuepress" ,
55 "main" : " index.js" ,
66 "publishConfig" : {
77 "access" : " public"
You can’t perform that action at this time.
0 commit comments