<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: scottgallant</title>
    <description>The latest articles on DEV Community by scottgallant (@scottgallant).</description>
    <link>https://dev.to/scottgallant</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F27872%2Fe93b6336-0774-470d-aa2a-614ccee5420f.jpg</url>
      <title>DEV Community: scottgallant</title>
      <link>https://dev.to/scottgallant</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/scottgallant"/>
    <language>en</language>
    <item>
      <title>Markdown Bot - An AI friend who improves your content</title>
      <dc:creator>scottgallant</dc:creator>
      <pubDate>Fri, 21 Jul 2023 17:19:30 +0000</pubDate>
      <link>https://dev.to/tinacms/markdown-bot-an-ai-friend-who-improves-your-content-1dpd</link>
      <guid>https://dev.to/tinacms/markdown-bot-an-ai-friend-who-improves-your-content-1dpd</guid>
      <description>&lt;p&gt;With &lt;a href="https://tina.io" rel="noopener noreferrer"&gt;TinaCMS&lt;/a&gt;, all your content changes are committed directly to Git. This enables your team to create a variety of workflows for reviewing and merging content updates. By leaning on GitHub, you can integrate CI/CD into your content workflow.&lt;/p&gt;

&lt;p&gt;To illustrate the potential of this combination, we're excited to introduce &lt;strong&gt;Markdown Bot&lt;/strong&gt;, an AI friend who improves your content by making suggestions to your Pull Requests.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/3SkumYmH8nc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Want to skip the reading and jump straight to the code? &lt;a href="https://github.com/tinacms/markdown-bot" rel="noopener noreferrer"&gt;Check out the open source repo&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  A Useful Aid, Not a Replacement
&lt;/h2&gt;

&lt;p&gt;AI can be a valuable tool for assisting with writing and editing content. We've designed this bot not to replace content editors, but rather to augment their capabilities. The bot offers content suggestions directly in your pull requests. If you find the suggestions helpful, you can commit them with a click. If not, they're just as easily dismissed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fforestry-demo%2Fimage%2Fupload%2Fv1689957451%2Fblog-media%2Fmarkdown-bot%2FScreenshot_2023-07-21_at_12.36.48_PM_ztpdes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fforestry-demo%2Fimage%2Fupload%2Fv1689957451%2Fblog-media%2Fmarkdown-bot%2FScreenshot_2023-07-21_at_12.36.48_PM_ztpdes.png" title="AI Suggestion in Github" alt="AI Suggestion in Github"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Markdown Bot Works On Your PRs
&lt;/h2&gt;

&lt;p&gt;There are many AI writing tools out there but if you use them with markdown content it often involved copying and pasting from AI outputs. We wanted something that could interact with our Content in GitHub. That's why we developed a GitHub bot that allows us to receive these suggestions right within a GitHub pull request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working with the GitHub Bot
&lt;/h2&gt;

&lt;p&gt;After you've integrated the bot into your repository, you can command it to make suggestions by commenting &lt;code&gt;ai fix: &amp;lt;path to file&amp;gt;&lt;/code&gt;. A custom prompt can be added by using &lt;code&gt;prompt: &amp;lt;Custom Prompt&amp;gt;&lt;/code&gt; underneath. The bot will then offer commit suggestions in the form of a pull request review.&lt;/p&gt;

&lt;p&gt;To get started &lt;a href="https://github.com/tinacms/markdown-bot" rel="noopener noreferrer"&gt;check out the open source repo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking Ahead: AI and Git-based Content
&lt;/h2&gt;

&lt;p&gt;Our GitHub bot works hand in hand with TinaCMS to enhance the content creation process. No longer do you need to manually copy and paste suggestions. The bot brings suggestions right to your pull requests for a smooth, efficient experience.&lt;/p&gt;

&lt;p&gt;We can envision some impressive custom workflows being built with AI and Git-based content. For instance, you could build off of this bot to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trigger the AI bot with custom events, such as opening a PR.&lt;/li&gt;
&lt;li&gt;Utilize analytics to suggest recommendations based on your top/bottom performing pages.&lt;/li&gt;
&lt;li&gt;Integrate this bot with your feedback widget, to open PRs based on user feedback.&lt;/li&gt;
&lt;li&gt;Catch insensitive, inconsiderate writing with tools like &lt;a href="https://github.com/get-alex/alex" rel="noopener noreferrer"&gt;alex&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are just a few of the many possibilities we see for integrating AI with Git-based content. We're excited about the potential here and look forward to seeing the creative workflows that the community will build.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Visual Open Authoring with Next.js &amp; TinaCMS</title>
      <dc:creator>scottgallant</dc:creator>
      <pubDate>Tue, 10 Mar 2020 19:19:52 +0000</pubDate>
      <link>https://dev.to/scottgallant/introducing-visual-open-authoring-mc6</link>
      <guid>https://dev.to/scottgallant/introducing-visual-open-authoring-mc6</guid>
      <description>&lt;p&gt;We're focused on improving the independent web as a whole. We want to craft tools that help people build better sites and create better content.&lt;/p&gt;

&lt;p&gt;In line with this mission, we sought to create something we call &lt;strong&gt;Visual Open Authoring&lt;/strong&gt; ✍️. The &lt;a href="https://css-tricks.com/netlify-cms-open-authoring/#article-header-id-0"&gt;open authoring concept&lt;/a&gt; was originally pioneered by &lt;a href="https://www.netlifycms.org/"&gt;Netlify CMS&lt;/a&gt; this past summer and involves opening up your website's CMS to accept content-related contributions from anyone. Using Tina, we were able to take this a step further, establishing the editing context &lt;strong&gt;on the page itself&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add an "Edit Mode" to Your Site
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Picture this:&lt;/strong&gt; on your website, there's an &lt;em&gt;"Edit this page on GitHub"&lt;/em&gt; link — familiar enough. But imagine that when you click it, instead of kicking you over to GitHub, the site itself becomes editable, &lt;strong&gt;like a Google Doc&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The experience should feel familiar for anyone that has used a word processor or site builder. You navigate to the page you want to change, click “Edit”, make updates in a WYSIWYG, and then submit your changes. That’s it 🧞‍♂️.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YLXmS7es--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://tinacms.org/gif/open-auth.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YLXmS7es--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://tinacms.org/gif/open-auth.gif" alt="TinaCMS Visual Open Authoring"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's under the hood?
&lt;/h2&gt;

&lt;p&gt;The scaffolding underneath &lt;strong&gt;Visual Open Authoring&lt;/strong&gt; is a Git-based workflow. Triggering "Edit Mode" creates a new fork to track and commit changes on. When content updates are ready, the editor can make a &lt;strong&gt;pull request&lt;/strong&gt;. The site owner can then review the work before making it live.&lt;/p&gt;

&lt;p&gt;Currently, this requires a GitHub account and some knowledge of Git workflows, making Open Authoring ideal for developer-centric sites (docs, wikis, etc). Soon, we will be opening up &lt;a href="https://tinacms.org/teams"&gt;Tina Teams&lt;/a&gt; so people without GitHub accounts can easily edit in real-time too.&lt;/p&gt;

&lt;p&gt;We are currently prototyping this on our own site. In the coming weeks, the APIs for integrating &lt;strong&gt;Visual Open Authoring&lt;/strong&gt; with Tina will become available. In the meantime, go to &lt;a href="https://tinacms.org/blog/introducing-visual-open-authoring"&gt;tinacms.org/blog/introducing-visual-open-authoring&lt;/a&gt; and click the &lt;strong&gt;edit button&lt;/strong&gt; at the top of the page to try it out. Feel free to reference this site’s &lt;a href="https://github.com/tinacms/tinacms.org"&gt;source code&lt;/a&gt; to see how it works.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9NsvdOtz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/forestry-demo/image/upload/w_800%2Cbo_2px_solid_grey/v1583778760/TinaCMS/click-edit-button.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9NsvdOtz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/forestry-demo/image/upload/w_800%2Cbo_2px_solid_grey/v1583778760/TinaCMS/click-edit-button.png" alt="edit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Next.js to Enable "Edit-mode"
&lt;/h2&gt;

&lt;p&gt;A new feature &lt;a href="https://nextjs.org/blog/next-9-3"&gt;announced in Next.js 9.3&lt;/a&gt; has been instrumental to providing the ideal experience for &lt;strong&gt;Visual Open Authoring&lt;/strong&gt;. The &lt;em&gt;preview mode&lt;/em&gt; capability allows us to host a website that is fully static by default, but switches to a dynamic mode that runs server code for users that have a special "preview" cookie set. What we refer to as "Edit Mode" for &lt;strong&gt;Visual Open Authoring&lt;/strong&gt; is the same as this Next.js "Preview Mode".&lt;/p&gt;

&lt;p&gt;The ability for a website to run statically by default, and then "wake up" into a dynamic web application in response to specific user actions, is revolutionary. It significantly simplifies the concerns of operating an editing environment with Tina. With this workflow, we don't have to host a separate &lt;a href="https://tinacms.org/blog/editing-on-the-cloud"&gt;Cloud Editing Environment&lt;/a&gt; — &lt;strong&gt;the live site is the editing environment!&lt;/strong&gt; And thanks to Git and our fork-based workflow, we can edit content from the production website worry-free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Crowdsourcing your content
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Visual Open Authoring&lt;/strong&gt; is a unique, low-friction approach to website editing. Thanks to the clever Next.js preview mode, Tina's content flexibility, and the seamless &lt;a href="https://tinacms.org/docs/inline-editing"&gt;Inline Editing&lt;/a&gt; experience, we're ready for a digital content revolution.&lt;/p&gt;

&lt;p&gt;What if it were effortless to fix a spelling error on the New York Times? Imagine contributing to the ReactJS documentation in an instant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The web is all about community&lt;/strong&gt;, crowdsourcing, and the power of many perspectives. The easier it is to make content contributions, the more viewpoints we incorporate. The less context switching, the &lt;em&gt;more space for creative expression&lt;/em&gt; of ideas.&lt;/p&gt;

&lt;p&gt;Let's democratize content and strengthen the independent web.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>jamstack</category>
      <category>cms</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Creating Markdown Drafts with  Gatsby and TinaCMS</title>
      <dc:creator>scottgallant</dc:creator>
      <pubDate>Wed, 30 Oct 2019 12:33:58 +0000</pubDate>
      <link>https://dev.to/tinacms/creating-markdown-drafts-with-gatsby-and-tinacms-bdp</link>
      <guid>https://dev.to/tinacms/creating-markdown-drafts-with-gatsby-and-tinacms-bdp</guid>
      <description>&lt;p&gt;One of the core features of an editorial workflow is to provide writers &amp;amp; editors a safe space for creating and iterating on content without these in-process posts publishing to production — draft-mode.&lt;/p&gt;

&lt;p&gt;This post will outline how to add a draft-state to your markdown files in a Gatsby site using &lt;a href="https://tinacms.org" rel="noopener noreferrer"&gt;TinaCMS&lt;/a&gt;. Based on the environment and the file’s draft state, they will be selectively ‘published’ or not published. In development, we will ‘publish’ all files so we can view and edit drafts and completed posts alike; whereas in production we are going to filter out draft posts in our graphQL queries.&lt;/p&gt;

&lt;p&gt;The code examples are based on the &lt;a href="https://github.com/tinacms/gatsby-starter-tinacms" rel="noopener noreferrer"&gt;gatsby-starter-tinacms&lt;/a&gt;. Feel free to reference that as you go along.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftinacms.org%2Fgif%2Fdraft-mode.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftinacms.org%2Fgif%2Fdraft-mode.gif" alt="Draft Mode in TinaCMS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Add the published field to MarkdownRemark nodes
&lt;/h2&gt;

&lt;p&gt;First off, we need to create a way to tell Gatsby what files to include (or not include) in the build process depending on the environment. To do this, we will add a &lt;code&gt;published&lt;/code&gt; field to every MarkdownRemark node. The published field is the faucet from which files get included in the build process. In development mode, the faucet is fully open, and all posts, regardless of their draft state, will be ‘published’ or sent through the build process. In production mode, the faucet filters out anything in draft state. So think of the published as a sort-of misnomer for includedInBuild.&lt;/p&gt;

&lt;p&gt;The first file we need to touch to do this is the gatsby-node.js file, which typically lives in the root of a site. This is a special gatsby file where we can access all of Gatsby’s Node-API’s, or access points to the GraphQL layer that processes all the data in a Gatsby site. The API we will use is called setFieldsOnGraphQLNodeType:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;GraphQLBoolean&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gatsby/graphql&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setFieldsOnGraphQLNodeType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// if the node is a markdown file, add the `published` field&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;MarkdownRemark&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;published&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;GraphQLBoolean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;frontmatter&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="cm"&gt;/*
          `published` is always true in development
              so both drafts and finished posts are built
          */&lt;/span&gt;
          &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NODE_ENV&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="cm"&gt;/*
          return the opposite of the `draft` value,
          i.e. if draft = true : published = false
          */&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;frontmatter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;draft&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Create only published pages
&lt;/h2&gt;

&lt;p&gt;While we’re in the gatsby-node.js file, we need to prevent files in a draft state from being created as pages by Gatsby. We need to query for all the MarkdownRemark files, specifically with the published field data, so we can only create pages if they are published or set to be included in the build.&lt;/p&gt;

&lt;p&gt;Let’s loop through all the posts and only call createPage for published content. This example code is using the createPages API, which is where you manipulate or handle the creation of pages in Gatsby.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createPages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reporter&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createPage&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;actions&lt;/span&gt;
 &lt;span class="c1"&gt;// Query for markdown nodes to use in creating pages.&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;graphql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="s2"&gt;`
     {
       allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC } limit: 1000) {
         edges {
           node {
             published
             fields {
               slug
                }
             frontmatter {
               title
               }
           }
         }
       }
     }
   `&lt;/span&gt;
 &lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="c1"&gt;// Handle errors&lt;/span&gt;
 &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;reporter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;panicOnBuild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Error while running GraphQL query.`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="c1"&gt;// Create pages for each markdown file.&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogPostTemplate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`src/templates/blog-post.js`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allMarkdownRemark&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;edges&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="c1"&gt;// if unpublished return, to prevent the page from being created&lt;/span&gt;
   &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;published&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
   &lt;span class="c1"&gt;// otherwise, create the `published` page&lt;/span&gt;
   &lt;span class="nf"&gt;createPage&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;blogPostTemplate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt;
   &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Filter unpublished pages at the query level
&lt;/h2&gt;

&lt;p&gt;Now that we have our published field controlling the flow of whether or not posts get included in the build, we need to adjust the queries in our templates and index list files so that we only query for published data.&lt;/p&gt;

&lt;p&gt;Go to the component or page file that renders a ‘list’ of all posts — this could be an index file on a simple blog, or a list page file on a more complicated site. In that file, let’s add a filter parameter to the allMarkdownRemark query:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;src/pages/index.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pageQuery&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;`
  query {
    // Only query for published markdown files
    allMarkdownRemark(filter: { published: { eq: true } }, sort: { fields: [frontmatter___date], order: DESC }) {
      edges {
        node {
          excerpt
          fields {
            slug
          }
          frontmatter {
            date(formatString: "MMMM DD, YYYY")
            title
            description
          }
        }
      }
    }
  }
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same goes for the query in the blog-post template.&lt;/p&gt;

&lt;p&gt;src/templates/blog-post.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pageQuery&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;`
  query BlogPostBySlug($slug: String!) {
    //  Unpublished pages will 404
    markdownRemark(published: { eq: true }, fields: { slug: { eq: $slug } }) {
      // ...
    }
  }
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now our templates and components dealing with any blog post data will conditionally handle published content depending on the build environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Add a “draft” indicator in development
&lt;/h2&gt;

&lt;p&gt;Since you’re already in your blog-post.js template file and you have added the filter parameter, we now need to add the ‘draft’ field to our query so we can conditionally render some indication of the post status in the component. You may need to restart the Gatsby dev server after adjusting this query.&lt;/p&gt;

&lt;p&gt;Add the draft to your blog-post.js query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pageQuery&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;`
  query BlogPostBySlug($slug: String!) {
    markdownRemark(published: { eq: true }, fields: { slug: { eq: $slug } }) {
      frontmatter {
        title
        date(formatString: "MMMM DD, YYYY")
        description
        // The new field
        draft
      }
    }
  }
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There’s lots of ways you can incorporate the ‘draft’ indicator status into your component. One way would be to conditionally render draft status instead of the date, based on the value of frontmatter.draft, as shown in the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;
  &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nf"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`block`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;marginBottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rhythm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;}}&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;frontmatter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;draft&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;DraftIndicator&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;frontmatter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;
  &lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Add the Draft Toggle to your Form
&lt;/h2&gt;

&lt;p&gt;Finally, let’s add this draft toggle field to the form, where we edit our blog posts with TinaCMS. Simply add this field to each page’s form definition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
     &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;frontmatter.draft&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;toggle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Draft&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt;&lt;br&gt;
Tina will only add the draft frontmatter value to files after it’s been edited. If the draft frontmatter value is not set on a file, it will be null (falsy)and will get published in all environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  That’s it!
&lt;/h2&gt;

&lt;p&gt;We successfully added ‘draft-mode’ to a simple blog. Now this configuration might look slightly different depending on your site, but feel free to reference the TinaCMS-site repo, specifically the blog template, to see this feature in action on a more complicated site.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>gatsby</category>
      <category>tinacms</category>
      <category>react</category>
    </item>
    <item>
      <title>Announcing TinaCMS</title>
      <dc:creator>scottgallant</dc:creator>
      <pubDate>Mon, 21 Oct 2019 17:01:51 +0000</pubDate>
      <link>https://dev.to/tinacms/announcing-tinacms-ddk</link>
      <guid>https://dev.to/tinacms/announcing-tinacms-ddk</guid>
      <description>&lt;p&gt;We’re excited to announce &lt;a href="https://github.com/tinacms/tinacms"&gt;TinaCMS&lt;/a&gt;: an open-source site editing toolkit for React-based sites, especially &lt;a href="https://nextjs.org"&gt;Next.js&lt;/a&gt;).  See the &lt;a href="https://www.youtube.com/watch?v=iPDCmbaEF0Y"&gt;announcement video&lt;/a&gt; at Jamstack Conf SF (the demo starts at 3:45).&lt;/p&gt;

&lt;p&gt;Tina is not a CMS, in the traditional sense. As in, it’s not a &lt;em&gt;separate&lt;/em&gt; system for managing content. Instead, Tina adds editing functionality to your site when running in dev mode locally, or when using &lt;a href="http://tina.io/cloud"&gt;TinaCloud&lt;/a&gt;...&lt;br&gt;
In fact, I'm writing this post with Tina right now:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---qeVJCb8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://res.cloudinary.com/forestry-demo/image/upload/v1571244588/tina-cms-announcement-post.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---qeVJCb8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://res.cloudinary.com/forestry-demo/image/upload/v1571244588/tina-cms-announcement-post.gif" alt="tina-announcement-gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you install Tina, your site gets a floating &lt;em&gt;edit&lt;/em&gt; icon in the corner that toggles an editing pane to expose the CMS fields. This gives your content editors a contextual editing experience that’s super intuitive. When you click "Save" Tina writes your content to external data sources, such as Markdown or JSON files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where does Tina store my content?
&lt;/h3&gt;

&lt;p&gt;Currently, Tina writes to Markdown and data files and commits to Git but it can be extended to write to other data sources (another headless CMS like Strapi or Contentful, or any API-based service like Google Sheets or Airtable). When running locally, Tina writes to the file system and if you're using &lt;a href="http://tina.io/cloud"&gt;Tina Cloud&lt;/a&gt;, it commits to your GitHub repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Tina?
&lt;/h3&gt;

&lt;p&gt;I’ve been setting up content management systems for people since the early 2000’s. In the beginning, CMSs like WordPress and Drupal gave our non-developer colleagues website editing powers. But we’ve seen very little innovation on the editing experience in the past 10+ years. Meanwhile, the editing experience of site builders like Squarespace, Wix and Webflow have become very sophisticated.&lt;/p&gt;

&lt;p&gt;When I watch people use a traditional CMS, I often see them struggle because the input (the CMS) lacks the context of the output (their site) and using a CMS feels more like filing your taxes than editing a website. Now that we’ve moved to headless CMSs and the Jamstack, editors often lose the ability to preview, leaving them in the dark as they create content.&lt;/p&gt;

&lt;p&gt;We developers have hot-reloading, and Tina is hot-reloading for content editors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Get Started
&lt;/h3&gt;

&lt;p&gt;We're coming out of a monolithic CMS era and we believe next-gen sites need a next-gen CMS. Checkout Tina and let us know what you think!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://tinacms.org/docs/getting-started/introduction"&gt;TinaCMS Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/tinacms/tinacms"&gt;TinaCMS GitHub repo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tinacms.org/community"&gt;Tina Community&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
