nuxt-content-hooks-git v1.0.7
nuxt-content-hooks-git
nuxt-content hooks that replace or add createdAt and updatedAt dates based on the git history.
ℹ️ There is also a Nuxt.js module that does the same thing and is probably cleaner to use.
Install
# npm
$ npm install nuxt-content-hooks-git
# Yarn
$ yarn add nuxt-content-hooks-git
Usage
Add the hooks to your hooks config:
import nuxtContentHooksGit from 'nuxt-content-hooks-git'
export default {
hooks: {
...
...nuxtContentHooksGit(),
},
}
This will replace doc.createdAt
and doc.updatedAt
with the dates from the Git log.
It is also possible to not override the values but instead specify the field names like this:
import nuxtContentHooksGit from 'nuxt-content-hooks-git'
export default {
hooks: {
...
...nuxtContentHooksGit({ createdAtName: 'gitCreatedAt', updatedAtName: 'gitUpdatedAt' }),
},
}
Then you can access them via doc.gitCreatedAt
and doc.gitUpdatedAt
.
Contribute
Are you missing something or want to contribute? Feel free to file an issue or a pull request! ⚙️
Support
Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here:
Thanks a lot for your support! ❤️