-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Netlify fields config and markdowning #50
Conversation
…of-things Automatically generated. Merged on Netlify CMS.
Automatically generated. Merged on Netlify CMS.
@@ -0,0 +1,28 @@ | |||
--- | |||
title: '[Test] Big Project' | |||
summary: >- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pointing out here the default way that markdown widget fields get generated from Netlify CMS to .md
.
goals: null | ||
type: project | ||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, no body text below the frontmatter.
beneath the frontmatter. There are cases where we might need more than | ||
one markdown field. Otherwise, we have to look into how Netlify CMS | ||
creates md files. | ||
*/} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For project .md files that have text beneath the frontmatter, the gatsby-remark plugin nicely add the html to the GraphQL node. But now, I need to solve how the transform frontmatter values to html
- name: "project" | ||
label: "Project" | ||
folder: "src/pages/project" | ||
create: "true" | ||
slug: "{{title}}" | ||
fields: | ||
- {label: "Title", name: "title", widget: "string"} | ||
- {label: "Body", name: "body", widget: "markdown"} | ||
- {label: "Summary Description", name: "summary", widget: "markdown"} | ||
- {label: "Stage", name: "stage", widget: "select", options: ["Proposed", "Planning", "Implementing", "Live"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is where I spun some cycles trying to learn how to create options from select dropdown.
- {label: "Contact Person", name: "contact_name", widget: "string", required: false} | ||
- {label: "Contact Email", name: "contact_email", widget: "string", required: false} | ||
- {label: "Related City Goals", name: "goals", widget: "string", required: false} | ||
- {label: "Collection Type", name: "type", widget: "hidden", default: "project"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was useful to create a hidden field so that I could have a consistent value to filter on to display the projects in a list on the landing page. But I was surprised there wasn't already some Collection Type available. This seems like exactly the type of thing the hidden widget was made for but also feels hacky.
This is a big commit. It adds a lot of styling for external places that we will eventually chip away at and refine into a Zilker-React component style guide. Add Sass library to Gatsby. Pulls in stylesheets from Fellows site. Adds lib files from uswds-react project.
The main thing undone here is translating markdown in frontmatter to HTML. Made a separate issue for that... #56 |
@mateoclarke hey there - Netlify CMS lead here, noticed your PR linked to one of our issues. Great feedback! Thought I'd note a couple of things, hope it's helpful:
If you run into anymore issues, reach out on Gitter, it's very active, plenty of helpful folks there to assist. Cheers! |
Ok, this PR is a WIP, but I wanted to start a conversation about some of the first real limitations I'm starting to see based on Netlify CMS.
CMS UI Bugs 🐛
First, the CMS UI is kinda buggy. The cool thing is that its open source so we can write fixes and push upstream, but that's not my focus right now. Remember, I just running the CMS SPA from a CDN. This was one small hint that things still aren't very stable.
Here is how you would reproduce: Starting with an existing Project collection open to be edited. Went to the top nav, plus sign to create a new Project. The page seemed to transition, seemingly ready to create a new Project, but the old state of the markdown WSIWYG box still had the text from the previous page. Small thing, but telling on the maturity of this thing.
Poor Docs
Also, documentation needs improvement. I was reading the docs on the out-of-the box widgets trying to learn how to create the select options for a field with a the dropdown select widget. This was hard to Google. I eventually found this issue (8 days old), which led me to this example. Another small thing. And this one even easier for us to make a PR and improve for the community. In general, there is more code diving to get to understanding on how things work, what the defaults are (for example, all fields are required by default), etc.
Markdown
Last thing, some of the code in my last PR was around setting up Gatsby to read markdown files and transform them into GraphQL queries. I really like that feature of Gatsby, though it is very different at first. The confusion for me is this. When you are normally writing markdown files, you have your yml frontmatter with a body section below. In the body is where the markdown formatted texts goes. (As far as I can see so far, again hard because of bad docs) When Netlify generates its markdown files as PRs in the content editing workflow, it doesn't put anything in the body section of the .md file. Everything gets put into the frontmatter. This makes sense in some ways. We could have a multiple markdown widgets for a Collection Item and we can't have two separated bodies under the frontmatter.
But this means, I need to rewire or find a different solution for transforming data in the markdown files into html instead using the
markdownRemark
plugin the way Gatsby recommended in their docs. https://www.npmjs.com/package/gatsby-transformer-remarkI'll point to some lines below