Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tjventurini/vuepress-plugin-zengarden-publish
Adds a publish flag to all pages.
https://github.com/tjventurini/vuepress-plugin-zengarden-publish
Last synced: 10 days ago
JSON representation
Adds a publish flag to all pages.
- Host: GitHub
- URL: https://github.com/tjventurini/vuepress-plugin-zengarden-publish
- Owner: tjventurini
- License: mit
- Created: 2020-05-05T15:51:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-05T16:29:36.000Z (over 4 years ago)
- Last Synced: 2024-10-10T18:22:34.471Z (about 1 month ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VuePress Plugin Zengarden Publish
Adds the `publish` attribute to the frontmatter of each page.
## Installation
```bash
npm install vuepress-plugin-zengarden-publish
# or
yarn add vuepress-plugin-zengarden-publish
```## Usage
In your `config.js` or `index.js` files of your VuePress configuration, add the following.
```javascript
['zengarden-publish']
```Now you should have the `publish` flag set in the `frontmatter` of all your pages.
You can set the `publish` flag your self, the plugin will not overwrite the value if it is already set.
## Configuration
Per default we use the `date` attribute of a pages `frontmatter` to determine if a page should be published. If you need to change this behavior, then you can just overwrite the used function like so.
```javascript
['zengarden-publish', {
publish: function(page) {
// this is the default logic used
return dayjs().format('YYYY-MM-DD') >= dayjs(page.frontmatter.date).format('YYYY-MM-DD')
}
}]
```You will get the full page object so the setup is very flexible. Also as you can see.