Vagr9K / gatsby-material-starter

A high performance blog starter with Material design in mind for GatsbyJS.
https://gatsby-theme-material.netlify.app/
MIT License
514 stars 178 forks source link

How to add content #296

Closed gardner closed 2 years ago

gardner commented 2 years ago

Summary

Please excuse the naivety of this question. I have been trying to understand how to modify the content. The "posts" appear to be sourced from mdx files in the npm module. I'd like to replace the posts with my own data.

Adding mdx files in key locations results in files that don't include the default layout.

I tried setting the variables in gatsby-config.js

contentDir: './content',
assetDir: './assets',

This results in an error Field "cover" must not have a selection since type "String" has no subfields.

How are .md and .mdx files meant to be added to the starter?

File contents (if changed)

gatsby-config.js: N/A

      options: {
        contentDir: './content',
        assetDir: './assets',
      },

Trying to find the data to change:

$ find . -type f -exec grep -l 'Markdown Cheatsheet' {} \;
./node_modules/gatsby-theme-advanced/content/Big_Sample_Test.mdx
./node_modules/gatsby-theme-advanced/src/types/__snapshots__/index.spec.ts.snap
./node_modules/gatsby-theme-advanced/src/components/SEO/tests/__snapshots__/index.spec.tsx.snap
./node_modules/gatsby-theme-advanced/src/templates/tests/__snapshots__/PostTemplate.spec.tsx.snap
./node_modules/gatsby-theme-advanced/src/templates/feed/tests/__snapshots__/FeedTemplate.spec.tsx.snap
./node_modules/gatsby-theme-advanced/src/templates/feed/tests/__snapshots__/useInfiniteFeed.spec.tsx.snap
./public/feed_meta/tag-big-0.json
./public/feed_meta/index-0.json
./public/feed_meta/tag-markdown-0.json
./public/feed_meta/category-tech-0.json
./public/feed_meta/tag-test-0.json
./public/feed_meta/tag-programming-0.json
./public/page-data/category/tech/page-data.json
./public/page-data/the-fallen-time/page-data.json
./public/page-data/the-fairys-witches/page-data.json
./public/page-data/index/page-data.json
./public/page-data/tag/big/page-data.json
./public/page-data/tag/test/page-data.json
./public/page-data/tag/markdown/page-data.json
./public/page-data/tag/programming/page-data.json
./public/page-data/big-sample-test/page-data.json
./themes/material/test/fixtures/postListing.ts
./themes/material/test/fixtures/listingQuery.ts
./themes/material/test/fixtures/postQuery.ts
./themes/material/test/fixtures/feedMetadata/index-0.json
./themes/material/test/fixtures/post.ts
gardner commented 2 years ago

If you found this issue then please take note:

You must set these values in your gatsby-config.js:

contentDir: './content',
assetDir: './assets',

Markdown files go in your content directory. Markdown files must have a cover photo. The cover photo for the following markdown file would be in ./content/images/

---
title: "gardner"
cover: images/gardner.jpg
coverAlt: "gardner"
path: /gardner
description: "Description"
datePublished: "2022-07-23"
dateModified: "2022-07-23"
category: "tech"
tags:
  - programming
  - stuff
  - other
---
## gardner

gardner