0

I'm trying to create a simple blog for my site using local markdown. To my knowledge I've followed the Gridsome docs to accomplish this, but queries don't return any posts. I have installed source-filesystem and transformer remark.

module.exports = {
  siteName: 'My Blog',

  plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {
        path: './content/posts/**/*.md',
        typeName: 'Post',
      }
    }
  ],
}

My markdown files are in the content/posts folder, but when I use the GraphQL explorer it returns 0 for allPosts totalCount. Similarly, just making a <page-query> returns an error. Any help would be much appreciated.

  • Are you sure that there's actual files in the `content/posts/**` directory? As in you ran `gridsome build` to build those markdown files? I have a simple blog as well and my path looks like `content/posts/*/*/*.md` and I've had issues with file paths before so I would try removing the `./` in your path. – Robert Corponoi Nov 24 '20 at 22:27
  • I'm just using `gridsome develop` right now, but there are .md files in that directory. I also just tried `gridsome build`, as well as removing the `./` and neither has fixed it. – Luke Filipos Nov 25 '20 at 04:02
  • Did you ever figure this out? I’m having a similar problem as well. I have the .md file in a posts directory but it always returns empty. – DRD Mar 11 '22 at 20:01
  • I never did. Ended up switching to React/Gatsby as a result – Luke Filipos Mar 14 '22 at 16:55

0 Answers0