Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thombruce/nuxt-taxonomies
🏷 Nuxt plugin adding support for automatic handling of taxonomies with Nuxt Content.
https://github.com/thombruce/nuxt-taxonomies
nuxt nuxt-blog nuxt-content tags taxonomies taxonomy
Last synced: 1 day ago
JSON representation
🏷 Nuxt plugin adding support for automatic handling of taxonomies with Nuxt Content.
- Host: GitHub
- URL: https://github.com/thombruce/nuxt-taxonomies
- Owner: thombruce
- License: mit
- Created: 2021-06-07T02:01:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-27T22:10:36.000Z (almost 3 years ago)
- Last Synced: 2024-11-04T21:42:24.610Z (about 2 months ago)
- Topics: nuxt, nuxt-blog, nuxt-content, tags, taxonomies, taxonomy
- Language: JavaScript
- Homepage:
- Size: 136 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Nuxt Taxonomies
Plugin adding support for automatic handling of taxonomies with Nuxt Content.
## Installation
```sh
# With Yarn
yarn add @thombruce/nuxt-taxonomies
# With npm
npm install @thombruce/nuxt-taxonomies --save
```Add `@thombruce/nuxt-taxonomies` to `buildModules` in `nuxt.config.js`:
```js
buildModules: [
// ...
"@thombruce/nuxt-taxonomies",
// ...
],
```## Usage
```vue
export default {
async asyncData ({ $taxonomies }) {
// To list all tags found in /content/blog files
const tags = $taxonomies('tags', 'blog').all() // [{ slug: 'my-tag', title: 'My Tag' }, { slug: 'my-other-tag', title: 'My Other Tag' }]return { tags }
}
}
``````vue
<script>
export default {
async asyncData ({ $taxonomies }) {
// To retrieve a specific term
const term = $taxonomies('tags', 'blog').find('my-tag') // { slug: 'my-tag', title: 'My Tag' }return { term }
}
}```