Closed r-czajkowski closed 2 years ago
@r-czajkowski I think this will work for us 👍 good job. Looks like we have the text content in /src/pages/index.md
. Does this automatically map to the HomePageTemplate? How do you expect to organize the markdown files when more pages are added?
@r-czajkowski I think this will work for us 👍 good job. Looks like we have the text content in
/src/pages/index.md
. Does this automatically map to the HomePageTemplate? How do you expect to organize the markdown files when more pages are added?
Here is the magic https://github.com/threshold-network/splash-page/blob/gatsby/gatsby-node.ts#L42-L52. In the cms config we need to add a special hidden field: template
.
So to add a new page you have to:
md
file in src/pages
static/admin/config.yaml
to define fields something like here https://github.com/threshold-network/splash-page/blob/gatsby/static/admin/config.yml#L31-L101,src/templates
and the name of this file should be the same as is in the template
field and query the data from the cms eg. https://github.com/threshold-network/splash-page/blob/gatsby/src/templates/home-page.tsx#L124-L174If your md
file is eg. faq
then the page will be available under localhost:8000/faq
.
Depends on: #17
Fetching home page data from the cms.