Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

gatsby-source-lever

Package Overview
Dependencies
7
Maintainers
18
Versions
320
Issues
File Explorer

Advanced tools

gatsby-source-lever

Gatsby source plugin for building websites using the Lever.co Recruitment Software as a data source.

    5.8.0latest
    GitHub

Version published
Maintainers
18
Weekly downloads
712
decreased by-59.89%

Weekly downloads

Readme

Source

gatsby-source-lever

Source plugin for pulling data into Gatsby from Lever.co.

Wish list

Install

npm install gatsby-source-lever

How to use

// In your gatsby-config.js module.exports = { plugins: [ { resolve: "gatsby-source-lever", options: { // Your Lever site instance name. site: "lever", // Set verboseOutput to true to display a verbose output on `npm run develop` or `npm run build` // It can help you debug specific API Endpoints problems verboseOutput: false, }, }, ], }

GraphQL Query to get all jobs

allLever { edges { node { id lever_id createdAt text hostedUrl applyUrl categories { commitment location team } description descriptionPlain lists { text content } additional additionalPlain } } }

Site's gatsby-node.js example

If you wish to create Gatsby Pages for each Lever.co jobs, you can modify your gatsby-node.js.

const _ = require(`lodash`) const Promise = require(`bluebird`) const path = require(`path`) const { slash } = require(`gatsby-core-utils`) exports.createPages = ({ graphql, actions }) => { const { createPage } = actions return new Promise((resolve, reject) => { // The “graphql” function allows us to run arbitrary // queries against the local WordPress graphql schema. Think of // it like the site has a built-in database constructed // from the fetched data that you can run queries against. // ==== PAGES (LEVER) ==== graphql( ` { allLever { edges { node { id } } } } ` ) .then(result => { if (result.errors) { console.log(result.errors) reject(result.errors) } // Create Lever pages. const pageTemplate = path.resolve("./src/templates/page.js") // We want to create a detailed page for each // lever node. We'll just use the ID for the slug. _.each(result.data.allLever.edges, edge => { // Gatsby uses Redux to manage its internal state. // Plugins and sites can use functions like "createPage" // to interact with Gatsby. createPage({ // Each page is required to have a `path` as well // as a template component. The `context` is // optional but is often necessary so the template // can query data specific to each page. path: `/${edge.node.id}/`, component: slash(pageTemplate), context: { id: edge.node.id, }, }) }) }) // ==== END PAGES ==== // resolve() must be called at the end so Gatsby knows that we're done add pages. .then(resolve()) }) }

Keywords

FAQs

Last updated on 21 Mar 2023

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc