npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

nuxtjs-ghost

v1.1.14

Published

NuxtJS module to easily interact with the Ghost API

Readme

nuxtjs-ghost

build npm version npm downloads bundle size License

NuxtJS module to easily interact with the 👻 Ghost API

📖 Release Notes

Setup

To start using the module you first need to install it using the package manager of your choice.

Installation with yarn

yarn add nuxtjs-ghost

Installation with npm

npm install nuxtjs-ghost

After that you need to register the plugin, that NuxtJS can pick it up. To do this, add nuxtjs-ghost to your modules section of nuxt.config.js.

{
  modules: [
    'nuxtjs-ghost',
  ]
}

Configuration

The plugin needs an API key of your site and its endpoint URL. Optionally you can pass the version of the Ghost API you want to use. Typically the endpoint for your API is your sites hostname.

To set these values you have two options:

  1. Use the default module options
  2. Add your options globally to the nuxt.config.js
  3. Use environment variables

Module Options

When registering the module, don't register it as a string, but an array. The syntax should be:

{
  modules: [
    [
      'nuxtjs-ghost',
      {
        url: 'YOUR_API_ENDPOINT',
        key: 'YOUR_API_KEY'
      }
    ]
  ]
}

Global Configuration

To set up a global configuration, add the following object to your export of nuxt.config.js:

ghost: {
  url: 'YOUR_API_ENDPOINT',
  key: 'YOUR_API_KEY'
}

Environment Variables

If you don't want sensitive data in your code, or got multiple environments, you can use environment variables to configure this plugin.

GHOST_API_KEY: Sets the API key. GHOST_API_URL: Sets the API endpoint.

Usage

The usage is pretty straight forward. This package is just a wrapper for the official JavaScript Content API. Please check out their documentation to learn about filtering or pagination. The filter parameter of the following methods is an object representation of the available query filters.

To access the wrapper it is getting exposed to the application context as $ghost. Use it in your pages created(), or mounted() functions using this.

export default {
  async created() {
    const posts = await this.$ghost.getPosts()
  }
}

Or use it in SSR-mode inside of asyncData()

export default {
  async asyncData({ $ghost }) {
    const posts = await $ghost.getPosts()
    return {
      posts
    }
  }
}

All available methods are documented below:


async getPosts(filter) - Gets all posts matching the filter query.

Parameters:

  • (optional) filter: Object used for filtering. E.g.: {limit: 2, include: 'tags,authors'}

Returns: An array of posts


async getPost(query, filter) - Gets the post matching the identifier given in query.

Parameters:

  • query: Object giving the identifier of the post. Can be slug or id. E.g.: {slug: 'my-post'}
  • (optional) filter: Object used for filtering. E.g.: {formats: ['html', 'plaintext']}}

Returns: An object representing a post


async getAuthors(filter) - Gets all authors matching the filter query.

Parameters:

  • (optional) filter: Object used for filtering. E.g.: {include: 'count.posts'}

Returns: An array of authors


async getAuthor(query, filter) - Gets the author matching the identifier given in query.

Parameters:

  • query: Object giving the identifier of the author. Can be slug or id. E.g.: {id: '1234'}
  • (optional) filter: Object used for filtering. E.g.: {page: 2}

Returns: An object representing an author


async getTags(filter) - Gets all tags matching the filter query.

Parameters:

  • (optional) filter: Object used for filtering. E.g.: {include: 'count.posts'}

Returns: An array of tags


async getTag(query, filter) - Gets the tag matching the identifier given in query.

Parameters:

  • query: Object giving the identifier of the tag. Can be slug or id. E.g.: {id: '1234'}
  • (optional) filter: Object used for filtering. E.g.: {include: 'count.posts'}

Returns: An object representing a tag


async getPages(filter) - Gets all pages matching the filter query.

Parameters:

  • (optional) filter: Object used for filtering. E.g.: {limit: 2}

Returns: An array of pages


async getPage(query, filter) - Gets the page matching the identifier given in query.

Parameters:

  • query: Object giving the identifier of the page. Can be slug or id. E.g.: {id: '1234'}
  • (optional) filter: Object used for filtering. E.g.: {fields: ['title']}

Returns: An object representing a page


async getSettings() - Gets your sites settings.

Returns: An object representing your settings


Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using npm run dev

License

MIT License

Copyright (c) Tobias Dittmann