<?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: Benjamin Lannon</title>
    <description>The latest articles on DEV Community by Benjamin Lannon (@lannonbr).</description>
    <link>https://dev.to/lannonbr</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%2F110310%2F2d487871-ce6e-4219-b779-d9ae2be38e69.jpeg</url>
      <title>DEV Community: Benjamin Lannon</title>
      <link>https://dev.to/lannonbr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lannonbr"/>
    <language>en</language>
    <item>
      <title>How does Dev internally catch posts that violate TOS?</title>
      <dc:creator>Benjamin Lannon</dc:creator>
      <pubDate>Mon, 28 Oct 2019 12:40:26 +0000</pubDate>
      <link>https://dev.to/lannonbr/how-does-dev-internally-catch-posts-that-violate-tos-2507</link>
      <guid>https://dev.to/lannonbr/how-does-dev-internally-catch-posts-that-violate-tos-2507</guid>
      <description>&lt;p&gt;This weekend I was endlessly scrolling through the main feed and saw some content that was violating TOS. Some was promoting things like vacations, or posts linking to sites with sexual content. I used the &lt;code&gt;report abuse&lt;/code&gt; feature to report them, but given the traffic of the site, I am curious if the team has other avenues or tools to catch these types of posts and take them down?&lt;/p&gt;

</description>
      <category>meta</category>
    </item>
    <item>
      <title>GitHub Actions v2: JS Actions</title>
      <dc:creator>Benjamin Lannon</dc:creator>
      <pubDate>Sat, 17 Aug 2019 13:18:24 +0000</pubDate>
      <link>https://dev.to/lannonbr/github-actions-v2-js-actions-3544</link>
      <guid>https://dev.to/lannonbr/github-actions-v2-js-actions-3544</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally written on &lt;a href="https://lannonbr.com/blog/2019-08-17-gh-actions-js-actions/"&gt;lannonbr.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UJkqvOXQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tnptd5gph3d6783mqwow.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UJkqvOXQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tnptd5gph3d6783mqwow.png" alt="GitHub Actions Branding"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GitHub announced on August 8 a new beta of GitHub Actions including CI &amp;amp; CD support. I want to look into a variety of new features added into the new beta and capabilities they can do.&lt;/p&gt;

&lt;p&gt;This post will look into the new "JavaScript Actions", which allows you to build new actions by just writing JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repo setup &amp;amp; action.yml
&lt;/h2&gt;

&lt;p&gt;We can start out creating a JS Action by creating a directory where our action will live.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;my-cool-action
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next, a file needs to be generated to describe some metadata for the particular action. Create a file named &lt;code&gt;action.yml&lt;/code&gt; and fill it in with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;My Cool Action&lt;/span&gt;
&lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Benjamin Lannon&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Action&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;that&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;does&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;some&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;cool&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;stuff!'&lt;/span&gt;
&lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Name'&lt;/span&gt;
    &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Benjamin'&lt;/span&gt;
&lt;span class="na"&gt;runs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;using&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;node12'&lt;/span&gt;
  &lt;span class="na"&gt;main&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;main.js'&lt;/span&gt;
&lt;span class="na"&gt;branding&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;green'&lt;/span&gt;
  &lt;span class="na"&gt;icon&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;send'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The details for the YAML syntax can be found on GitHub's docs here: &lt;a href="https://help.github.com/en/articles/metadata-syntax-for-github-actions"&gt;action.yml syntax docs&lt;/a&gt;. It is the file that will allow GitHub to know what file to look for when developing. The main things required are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;name&lt;/code&gt;: Gives your action a name.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;description&lt;/code&gt;: Gives an explanation of what the action is going to do.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;runs.using&lt;/code&gt;: tells you what kind of action it is. It currently supports either &lt;code&gt;docker&lt;/code&gt; for container based actions, or &lt;code&gt;node12&lt;/code&gt; which is what we are using for JS based actions.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;runs.main&lt;/code&gt;: When using &lt;code&gt;node12&lt;/code&gt; in &lt;code&gt;runs.using&lt;/code&gt;, this param defines where your entrypoint is going to be located in the current directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As well, a field that is optional but good to look at is the &lt;code&gt;inputs&lt;/code&gt; field which defines inputs to the action. all of the IDs will be translated to an environment variable as &lt;code&gt;INPUT_&lt;/code&gt; followed by the ID in uppercase (ex: &lt;code&gt;name&lt;/code&gt; will be available as &lt;code&gt;INPUT_NAME&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Next, we can create a main.js file to actually run some JS as part of an action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// main.js&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&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;INPUT_NAME&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Hello, &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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is an extremely basic example that gets a field from the action and logs out to the console, but it proves that all you need to do to get started with JS Actions is a single yaml file and a JS file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inserting into a GitHub Actions Workflow file
&lt;/h2&gt;

&lt;p&gt;Next, I am going to create a workflow that will use this action. I pushed this repo to GitHub so we can prepare to create the workflow.&lt;/p&gt;

&lt;p&gt;Next, we want to create a workflow file. It will live in the &lt;code&gt;.github/workflows&lt;/code&gt; directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .github/workflows/main.yml&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run JS Action&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;push&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;run-action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v1&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-cool-action&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Ben'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Going step by step down the file, we describe the workflow, when to execute, and what to execute&lt;/p&gt;

&lt;p&gt;&lt;code&gt;name&lt;/code&gt; gives a name for this workflow at large.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;on&lt;/code&gt; describes the event(s) that this action will run on. Here we chose &lt;code&gt;push&lt;/code&gt; which happens any time a new commit is pushed to the repo. There's a large list of &lt;a href="https://help.github.com/en/articles/events-that-trigger-workflows"&gt;Event Triggers&lt;/a&gt; in the docs that will start workflows.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;jobs&lt;/code&gt; then defines the set of jobs we need to run in the workflow. Currently we just want to run one job, so we create a single entry and give it an id of &lt;code&gt;run-action&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this job, we define the environment we want to run it in using the &lt;code&gt;runs-on&lt;/code&gt; field. Here we choose &lt;code&gt;ubuntu-latest&lt;/code&gt; (which at the time is the newest LTS, 18.04), but we can also run it on &lt;code&gt;windows&lt;/code&gt; or &lt;code&gt;macos&lt;/code&gt; if we so choose. You can learn here on the &lt;a href="https://help.github.com/en/articles/virtual-environments-for-github-actions"&gt;Virtual Environments&lt;/a&gt; that your actions run in.&lt;/p&gt;

&lt;p&gt;Following, each job has a series of steps you want to run. The first step is fetching the repo down and checking out into it using an action built by GitHub called &lt;a href="https://github.com/actions/checkout"&gt;actions/checkout&lt;/a&gt;. Each step has a &lt;code&gt;uses&lt;/code&gt; field which tells where to find an action. This can include relative paths in the same repo, owner/repo strings (including tags or commit SHAs), paths to a Dockerfile, or even docker images on a registry, and plenty of variations of all of these as defined further in the &lt;a href="https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepsuses"&gt;Actions Docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our second step is going to use our action. The relative path for the &lt;code&gt;uses&lt;/code&gt; field starts at the root of the repo, and given we dropped the &lt;code&gt;action.yml&lt;/code&gt; file in the root, which is how GitHub finds a JS action, we set the &lt;code&gt;uses&lt;/code&gt; field to &lt;code&gt;./&lt;/code&gt;. With it as well, we want to pass in our inputs which we can do using the &lt;code&gt;with&lt;/code&gt; field which is a series of entries that match to the &lt;code&gt;inputs&lt;/code&gt; in our &lt;code&gt;action.yml&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;For other information about the syntax for workflow files, head over to the &lt;a href="https://help.github.com/en/articles/workflow-syntax-for-github-actions"&gt;Workflow syntax for GitHub Actions&lt;/a&gt; page in the docs.&lt;/p&gt;

&lt;p&gt;If we finally commit this file, it will trigger a &lt;code&gt;push&lt;/code&gt;, and such trigger the workflow itself. If you see below, GitHub provides a UI which we can see all of our jobs running and with such, the action we built works!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QyqVAGvh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ueb3dg0flxqek2ipn6hk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QyqVAGvh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ueb3dg0flxqek2ipn6hk.png" alt="GitHub Actions Workflow run UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Follow up
&lt;/h2&gt;

&lt;p&gt;This was an introduction to setting up a JS Action with the new GitHub Actions and creating a workflow. In future posts, I will dive into other new features around GitHub Actions Beta 2 and what we can create with them. Up next, I will follow this article up with creating more advanced actions that interact with GitHub's API using some libraries the Actions team made that makes writing actions easier to manage. Stay tuned.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Writing a validator for Gatsby's Site Showcase</title>
      <dc:creator>Benjamin Lannon</dc:creator>
      <pubDate>Sun, 17 Mar 2019 18:23:39 +0000</pubDate>
      <link>https://dev.to/lannonbr/writing-a-validator-for-gatsbys-site-showcase-4723</link>
      <guid>https://dev.to/lannonbr/writing-a-validator-for-gatsbys-site-showcase-4723</guid>
      <description>&lt;p&gt;This past weekend, I made a simple node script to run through the site showcase for GatsbyJS and was very happy with the end results and wanted to talk through the process.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why do this?
&lt;/h1&gt;

&lt;p&gt;As Gatsby continues to grow with currently over 450 sites in the showcase as a place to show off sites that use Gatsby, being able to maintain and see occasionally that the sites still are around and using Gatbsy is a good sanity check.&lt;/p&gt;

&lt;p&gt;As well, this could be good to add into a CI process so when someone submits a site to the showcase, the check could be automated rather than needing to manually check if it is actually a Gatsby site.&lt;/p&gt;

&lt;h1&gt;
  
  
  Dig into the code
&lt;/h1&gt;

&lt;p&gt;The entire source for this is located on my GitHub:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/lannonbr" rel="noopener noreferrer"&gt;
        lannonbr
      &lt;/a&gt; / &lt;a href="https://github.com/lannonbr/gatsby-site-showcase-validator" rel="noopener noreferrer"&gt;
        gatsby-site-showcase-validator
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Node script to validate links on Gatsby Site Showcase are actually Gatsby sites
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Gatsby Site Showcase Validator&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Notice&lt;/strong&gt;: This Repo is archived as it has been merged into Gatsby's core repo here: &lt;a href="https://github.com/gatsbyjs/gatsby/tree/master/.github/actions/gatsby-site-showcase-validator" rel="noopener noreferrer"&gt;https://github.com/gatsbyjs/gatsby/tree/master/.github/actions/gatsby-site-showcase-validator&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A simple node script that visits and checks all of the sites in the &lt;a href="https://www.gatsbyjs.org/showcase/" rel="nofollow noopener noreferrer"&gt;Site Showcase&lt;/a&gt; for Gatsby.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Instructions&lt;/h2&gt;

&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Clone down the repository&lt;/li&gt;
&lt;li&gt;Install the dependencies with npm or yarn&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;node index.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Run in Docker&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;You can also run it in Docker with the following command:&lt;/p&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;docker run --rm lannonbr/gatsby-site-showcase-validator:1.0.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/lannonbr/gatsby-site-showcase-validator" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Starting out, I pull down the &lt;a href="https://github.com/gatsbyjs/gatsby/blob/master/docs/sites.yml" rel="noopener noreferrer"&gt;sites.yml&lt;/a&gt; file from Gatsby's repo which is used to build the showcase and parse it with &lt;a href="https://www.npmjs.com/package/js-yaml" rel="noopener noreferrer"&gt;js-yaml&lt;/a&gt;. Now I have an array of sites and I loop through each and fetch the main_url for each site.&lt;/p&gt;

&lt;p&gt;Then when I have the HTML from an individual site, I pass it into &lt;a href="https://cheerio.js.org/" rel="noopener noreferrer"&gt;cheerio&lt;/a&gt; which is a DOM parser for NodeJS that has a jQuery like API.&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;let&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cheerio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;siteHtml&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main part of the code is to check if it has an element with the "___gatsby" id. which is the default container that is built as part of 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;gatsbyContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#___gatsby&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&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;gatsbyContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// The page is a gatsby site&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// The page is not a gatsby site, print out an error message&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Otherwise, in total the file is only about 70 lines of code but overall it did a fairly good job.&lt;/p&gt;

&lt;h1&gt;
  
  
  Results
&lt;/h1&gt;

&lt;p&gt;So from the stats, there were only ~20 sites that were either not loading or have moved off of Gatsby as a framework. Doing the math that is less than 5% which is a low percentage so it shows that the site showcase is reputable in showing that the sites that say they are a Gatsby site actually are.&lt;/p&gt;

&lt;p&gt;Some cases for why there is a number of sites which return up being invalid likely end up being because the site used to be a Gatsby site but since was rewritten and then was forgotten to be removed from the showcase. Now that a tool like this is around, the number can decrease further and stay fairly low. It's a large task to maintain a large site showcase, but with a little bit of automation and scripts, the task can be made easier.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>gatsby</category>
    </item>
    <item>
      <title>How does your company value documentation? </title>
      <dc:creator>Benjamin Lannon</dc:creator>
      <pubDate>Sun, 24 Feb 2019 14:52:04 +0000</pubDate>
      <link>https://dev.to/lannonbr/how-does-your-company-value-documentation--41e9</link>
      <guid>https://dev.to/lannonbr/how-does-your-company-value-documentation--41e9</guid>
      <description>&lt;p&gt;Although many of us benefit from the usage of documentation of both internal and external products, compared to other portions of the codebase including testing or the actual code, documentation can sometimes be lacking.&lt;/p&gt;

&lt;p&gt;I want to ask the community how does your company value documentation? If it doesn't as much as you wish, how do you sell to a manager or your team that it would be beneficial to have a stronger focus on documentation?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>documentation</category>
    </item>
  </channel>
</rss>
