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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-plugin-enonic

v0.9.0

Published

GatsbyJS plugin to create static pages for headless content from Enonic XP

Downloads

7

Readme

Gatsby plugin for Enonic XP

This little plugin helps you generate static Gatsby pages based on data fetched via Headless API from Enonic XP.

By using GraphQL queries in plugin configuration you can specify data fields which you will output on the site pages.

Pre-requisites

This plugin can only be used in a GatsbyJS site or application. It also requires an endpoint to GraphQL API, either preconfigured or provided by Enonic Headless starter.

Usage

To install:

npm install --save gatsby-plugin-enonic

Then add the config to your gatsby-config.js:

module.exports = {
  /* ... */
  plugins: [
    /* ... */

    {
      resolve: "gatsby-plugin-enonic",
      options: {
        api: "http://localhost:8080/site/hmdb/draft/hmdb/_graphql",
        refetchInterval: 30,
        pages: [{
          query: require.resolve('./src/queries/getMovies'),
          list: {
            url: "/movies",
            template: require.resolve("./src/templates/movies.js"),
            title: 'Movies'
          },
          details: {
            url: '/movie', // Remove to use list.url
            template: require.resolve("./src/templates/movie.js"),
            key: 'name',
            title: '.displayName'
          }
        }]
      }
    }
  ]
}

options

api

GraphQL API endpoint delivering headless content.

refetchInterval

(optional)

How often data is re-fetched from the server (in seconds).

pages.query

Relative path to a Javascript file which exports (via module.exports) a GraphQL query to retrieve nodes to be listed on the pages.list.path page. Must be resolved with require.resolve().

pages.list.url

Expected URL for the generated listing page, for example if you use movies the page will be available under mysite.com/movies. Will also be used for detail pages if pages.details.url is not provided.

pages.list.template

Relative path to React template of the listing page. Must be resolved with require.resolve().

pages.list.title

(optional)

Page title for the listing page.

pages.details.url

(optional)

Expected URL for the generated details page, for example if you use movie the page will be available under mysite.com/movie/{key}. If omitted, value from pages.list.url will be used.

pages.details.key

(optional)

Field in the query whose value will be appended to pages.details.url. If omitted, id field will be used.

pages.details.template

Relative path to React template of the detail page. Must be resolved with require.resolve().

pages.details.title

(optional)

Page title for the detail page.

Example

For a working example of gatsby-plugin-enonic, see Gatsby plugin guide.

Thanks

This plugin uses gatsby-source-graphql to make GraphQL schema from Headless API available to Gatsby.

Helpful links