datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 50 forks source link

childMarkdownRemark is null #144

Closed anshumansworld closed 3 years ago

anshumansworld commented 3 years ago

I have 2 Multiple-paragraph text fields in DatoCMS.

  1. Excerpt
  2. content

But I only get childMarkdownRemark for Excerpt and not for content.

For example, I am querying as

      contentNode {
        childMarkdownRemark {
          html
          timeToRead
        }
      }
      excerptNode {
        childMarkdownRemark {
          html
          timeToRead
        }
      }

And the result is something like:

       {
          "contentNode": {
            "childMarkdownRemark": null
          },
          "excerptNode": {
            "childMarkdownRemark": {
              "html": "<p>Test content</p>",
              "timeToRead": 1
            }
          }
        }

Anything I'm missing?

Note: For content I'm using HTML editor & for Excerpt I'm using Markdown editor

stefanoverna commented 3 years ago

Yep, childMarkdownRemark (understandably!) only works if your field is set to be a Markdown editor!

claygiffin commented 3 years ago

@stefanoverna I do not think that this solution satisfies the use cases for the Simple Text Area content type.

When querying a simple text area with multiple paragraphs, graphql does return markdown for paragraph returns (\n).

For example, inputing this text into Dato:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi et odio semper, blandit felis ac, faucibus enim.

Quisque at scelerisque ante, ut rutrum tellus.

will return the following when querying in graphql:

"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi et odio semper, blandit felis ac, faucibus enim.\n\nQuisque at scelerisque ante, ut rutrum tellus."

yet trying to query lipsumNode {childMarkdownRemark} returns "null".

How should this be handled?

stefanoverna commented 3 years ago

@claygiffin could you share with me your project ID and model name, so that we can figure out what's going on? If you prefer to keep those private you can send us a support request at support@datocms.com with all the details and a reference to this conversation