• auto-front-matter
  • Artiely
  • #vuepress#vue#javaScript
  • 2020-03-29
  • 127
  • 1 min read
  • loading...

vuepress-plugin-auto-front-matter

自动生成部分重复性的 Front Matter。

----
author:
title:
date:
summary:
description:
location:
----
复制成功
1
2
3
4
5
6
7
8

Installation

yarn add -D vuepress-plugin-auto-front-matter
// or npm install vuepress-plugin-auto-front-matter -D

复制成功
1
2
3

Usage

// .vuepress/config.js

module.exports = {
    plugins: [
      ['auto-front-matter'],
      // other plugins
    ]
}

// or
module.exports = {
    plugins: [
      ['auto-front-matter',{
        author: 'Artiely' // 默认的全局作者
        summary: '详情请查看', // 默认的全局说明
        summaryLength: 200  // 说明的长度
        location: 'Wuhan,China' // 默认的全局地址
      }],
      // other plugins
    ]
}
复制成功
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

result

$page:{
  frontmatter:{
    title: "....",
    date: "2020-4-1",
    author: "Artiely",
    summary: "......",
    description: "......",
    location: "Wuhan,China",
    // ...
  }
}

复制成功
1
2
3
4
5
6
7
8
9
10
11
12

demo

https://artiely.gitee.io