Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

Nuxt Taxonomies

Become a Patron

GitHub issues

License

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 }
}
}

```