GithubHelp home page GithubHelp logo

mikefowler / gatsby-plugin-collections Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 3.0 875 KB

Create pages, with support for pagination and customizable permalinks, from a folder of Markdown files.

License: MIT License

JavaScript 0.58% TypeScript 99.42%

gatsby-plugin-collections's People

Contributors

mikefowler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gatsby-plugin-collections's Issues

Naming, Node version, other thoughts?

@KyleAMathews I am using this with good success in a couple of personal projects. Before I put it out into the world, I am curious about:

  • whether you have any thoughts on naming ("collections" vs โ“)
  • what version of Node I should be targeting with my Babel compilation?
  • literally anything else you can think of to reply with

๐Ÿ™Œ

Can't get plugin to work

Hi there!

As a fan of Jekyll, I was super excited to see your plugin! Unfortunately, I wasn't able to get it to work :(.

These are the errors I'm getting from running gatsby develop

error Syntax Error: Expected Name, found }
error Plugin gatsby-plugin-collections returned an error


  Error: There was a problem getting content for your posts collection. This is probably not your fault.

  - createPages.js:109 Object.<anonymous>
    [gatsby-site]/[gatsby-plugin-collections]/lib/createPages.js:109:43

  - createPages.js:32 step
    [gatsby-site]/[gatsby-plugin-collections]/lib/createPages.js:32:23

  - createPages.js:13 Object.next
    [gatsby-site]/[gatsby-plugin-collections]/lib/createPages.js:13:53

  - createPages.js:4 fulfilled
    [gatsby-site]/[gatsby-plugin-collections]/lib/createPages.js:4:58

  - util.js:16 tryCatcher
    [gatsby-site]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [gatsby-site]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [gatsby-site]/[bluebird]/js/release/promise.js:569:18

  - promise.js:606 Promise._settlePromiseCtx
    [gatsby-site]/[bluebird]/js/release/promise.js:606:10

  - async.js:142 _drainQueueStep
    [gatsby-site]/[bluebird]/js/release/async.js:142:12

  - async.js:131 _drainQueue
    [gatsby-site]/[bluebird]/js/release/async.js:131:9

  - async.js:147 Async._drainQueues
    [gatsby-site]/[bluebird]/js/release/async.js:147:5

  - async.js:17 Immediate.Async.drainQueues
    [gatsby-site]/[bluebird]/js/release/async.js:17:14

This was for a brand new gatsby website with nothing but gatsby-transformer-remark setup.
The site was generated with the latest Gatsby (v2.0.76) following these steps:

https://www.gatsbyjs.org/docs/quick-start

gatsby-plugin-collections was setup following your Quick Start docs:

https://github.com/mikefowler/gatsby-plugin-collections/blob/master/docs/quickstart.md

If there's something I'm missing, please let me know!
Excited to hear from you :)

Thanks!

Does not create a "collections" page

Perhaps I've misunderstood the purpose of this plugin, but my expectation is that it creates a page for the parent directory of a set of markdown files.

My config is as follows:

{
      resolve: 'gatsby-plugin-collections',
      options: {
        collections: [{
          name: 'blog-posts',
          path: 'content/blog',
          permalink: ':collection/:title',
          template: `${__dirname}/src/templates/post.js`
        }],
      },
    }

I'm pretty new to graphql and gatsby so please help me understand!

Plugin doesn't play nice with gatsby-remark-images or frontmatter File type fields.

When trying to use the plugin with image file types I get this error.

error Field "featuredImage" of type "File" must have a selection of subfields. Did you mean "featuredImage { ... }"?

I digged a little in the code and it's because getAvailableFrontmatterFields returns all the frontmatter fields which includes the ones set as File, which requires more parameters.

Solution would be to just ignore or query them the right way. I don't know if that's even possible I'm not very experienced in GraphQL.

Cannot read property 'entries' of undefined

I receive this error when I don't add the template: post-template in markdown file from my collections. And it don't continue creating the pages.

This error is caused by the query in file src/createPages.js at line 53, because it seems to be required. If I remove template it works like a charm.

I may suggest you to try another way to include templates from markdown, and not from gatbsy-node.js.

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.