GithubHelp home page GithubHelp logo

reese / gatsby-plugin-stork Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 1.03 MB

A Gatsby plugin for generating Stork search indexes.

License: MIT License

JavaScript 100.00%
gatsby gatsby-plugin search static-site stork

gatsby-plugin-stork's Introduction

🌱🌱🌱

Hello! I'm Reese (he/him), a Software Engineer working on ✨Ruby things✨ at Stripe, and previously I worked at HubSpot and The Gnar Company.

gatsby-plugin-stork's People

Contributors

dependabot[bot] avatar reese avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

krischer

gatsby-plugin-stork's Issues

Bug: Undefined errors while attempting to create new index

Hi Reese @reese ,

Thank you so much for creating this plugin! πŸ‘ I was trying to use this in my Gatsby site, and was unfortunately running into few internal errors from the plugin.

This is my configuration for the gatsby plugin. I have ensured and validated from Gatsby's GraphQL explorer that the below fields exist correctly for nodes of type annotations:

    {
      resolve: "gatsby-plugin-stork",
      options: {
        indexes: [
          {
            resolvers: {
              annotations: {
                url: node => node.fields.book_slug_path,
                title: node => node.extracted_google_books_metadata.book_title,
                contents: node => node.extracted_google_books_metadata.book_description,
              }
            },
            filename: 'annotations.st'
          }
        ],
        theme: "dark",
      }
    }

And for some reason, i keep on running into this exception below - which seems related to this line:

 ERROR #11321  PLUGIN

"gatsby-plugin-stork" threw an error while running the onPostBootstrap lifecycle:

Cannot set property 'title' of undefined

  60 |                             var key = _ref6[0],
  61 |                                 resolveFunc = _ref6[1];
> 62 |                             acc[key] = resolveFunc(node);
     |                                      ^
  63 |                           }, {});
  64 |                           files.push(resolvedValues);
  65 |                         }); // Serialize and write to TOML

File: node_modules/gatsby-plugin-stork/gatsby-node.js:62:38



  TypeError: Cannot set property 'title' of undefined

I tried to oversimplify the config above to this subsequently, i.e, just hardcoded strings - and even then I'm running into the same exception as above. Surely if there was some issue with my nodes configuration above and if that might have been resulting in the exception above, then it should have succeeded here:

    {
      resolve: "gatsby-plugin-stork",
      options: {
        indexes: [
          {
            resolvers: {
              annotations: {
                url: node => "test1",
                title: node => "test2",
                contents: node => "test3",
              }
            },
            filename: 'annotations.st'
          }
        ],
        theme: "dark",
      }
    },

Would really appreciate if you could help with this? If you need any other blob of local nodes or other related configs from my end for looking into this, please let me know.

Thanks! :)

Support generating multiple search indexes.

Some users may want to generate multiple search indexes based on multiple queries or configurations, such as searching only on an individual page, search only through one subset of content, etc.

Feature Request: Add support for pathPrefix in the plugin

Building on #12 - When using pathPrefix, urls in the plugin config must be pre-process with gatsby's pathPrefix before sending to Stork. This will help achieve both seamless local develop testing as well as correct urls in search results for production builds.

Add option to install Stork during CI builds.

Many users will deploy this using Github Actions, Netlify, or similar build providers. Installing Stork during CI builds by default (and allowing users to opt-out if needed) would save many users some headaches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.