<?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: Robert Guss</title>
    <description>The latest articles on DEV Community by Robert Guss (@howtocode_io).</description>
    <link>https://dev.to/howtocode_io</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%2F553609%2Ff2f95ff5-5b4d-49e4-93fc-3e1679a8ebd7.jpg</url>
      <title>DEV Community: Robert Guss</title>
      <link>https://dev.to/howtocode_io</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/howtocode_io"/>
    <language>en</language>
    <item>
      <title>Astro 2.0 Content Collections</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Tue, 07 Feb 2023 15:35:43 +0000</pubDate>
      <link>https://dev.to/howtocode_io/astro-20-content-collections-1k63</link>
      <guid>https://dev.to/howtocode_io/astro-20-content-collections-1k63</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/FS96vvn-W44"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This tutorial will teach you what &lt;a href="https://docs.astro.build/en/guides/content-collections/" rel="noopener noreferrer"&gt;content collections&lt;/a&gt; are and how they work in Astro 2.0.&lt;/p&gt;

&lt;p&gt;After creating a new Astro 2.0 project from scratch, we will create a content collection for blog posts. We will also define a &lt;a href="https://docs.astro.build/en/guides/content-collections/#defining-a-collection-schema" rel="noopener noreferrer"&gt;collection schema&lt;/a&gt; that will validate the Frontmatter of our blog posts, making it typesafe. Finally, we will learn how to generate dynamic routes for each post in the blog content collection.&lt;/p&gt;

&lt;p&gt;This tutorial assumes you are already familiar with how &lt;a href="https://docs.astro.build/en/core-concepts/routing/#dynamic-routes" rel="noopener noreferrer"&gt;dynamic routes work in Astro&lt;/a&gt;. If this concept is new to you, we highly recommend you read &lt;a href="https://docs.astro.build/en/core-concepts/routing/#dynamic-routes" rel="noopener noreferrer"&gt;Astro’s official docs&lt;/a&gt; to familiarize yourself with them. Throughout the tutorial, we will have links to various sections of the docs and external resources where you can learn more.&lt;/p&gt;

&lt;p&gt;We’ve got a lot to cover, so let’s get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are content collections?
&lt;/h2&gt;

&lt;p&gt;Content collections are one of the latest features released in Astro 2.0. They allow you to better organize your markdown and MDX content via the new &lt;code&gt;src/content&lt;/code&gt; directory and provide type safety for your Frontmatter and content. You can also &lt;a href="https://docs.astro.build/en/guides/content-collections/#querying-collections" rel="noopener noreferrer"&gt;query content collections&lt;/a&gt; to pull them into your templates and &lt;a href="https://docs.astro.build/en/guides/content-collections/#generating-routes-from-content" rel="noopener noreferrer"&gt;generate routes&lt;/a&gt; for each piece of content.&lt;/p&gt;

&lt;p&gt;This may all sound a bit abstract at the moment, but don’t worry. We will cover everything in detail throughout this tutorial, and by the end, you will be ready to create content collections in your own Astro projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a new Astro 2.0 project
&lt;/h2&gt;

&lt;p&gt;We can create an Astro 2.0 project by entering the following into our terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm create astro@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When asked if you would like to install the latest Astro package, press &lt;code&gt;y&lt;/code&gt; on your keyboard for yes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, you will be prompted to give your project a name. I will use the name &lt;code&gt;astro-content-collections&lt;/code&gt;, but you can name it whatever you want. Press Enter to continue.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgf31yurzynrj07kmyyxi.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgf31yurzynrj07kmyyxi.webp" alt="astro-project-name.png" width="800" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Then, select “a few best practices (recommended).”&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gj0vw9p78kvaa8qfle2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gj0vw9p78kvaa8qfle2.webp" alt="astro-best-practices.png" width="800" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, press &lt;code&gt;y&lt;/code&gt; to install NPM dependencies&lt;/li&gt;
&lt;li&gt;Next, you are asked to initialize a new Git repository. Press &lt;code&gt;n&lt;/code&gt; for no, as we won’t need it for this tutorial.&lt;/li&gt;
&lt;li&gt;Finally, select “strict” for the TypeScript setup.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjy9emvmngutnkvcttvlr.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjy9emvmngutnkvcttvlr.webp" alt="ts-setup.png" width="800" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After your project has been created, &lt;code&gt;cd&lt;/code&gt; into your project directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &amp;lt;project name&amp;gt;

&lt;span class="c"&gt;# For example&lt;/span&gt;
&lt;span class="c"&gt;# cd astro-content-collections&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Running the dev server
&lt;/h3&gt;

&lt;p&gt;To start the Astro dev server, enter the following in the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dev server will serve your app at &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;. You should see the following if you open this URL in your browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcde6f00x6uy1b0otmkwu.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcde6f00x6uy1b0otmkwu.webp" alt="astro-home-page.png" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are ready to create our blog content collection now that we have created our project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define a new collection schema
&lt;/h2&gt;

&lt;p&gt;The first thing we will need to do is to create two new folders. Within the &lt;code&gt;src&lt;/code&gt; folder, create a new folder called &lt;code&gt;content&lt;/code&gt;. Within the &lt;code&gt;content&lt;/code&gt; folder, create a new folder called &lt;code&gt;blog&lt;/code&gt;. The entire file path should be &lt;code&gt;src/content/blog&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde6l3zzv4i5o1fl1usbc.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde6l3zzv4i5o1fl1usbc.webp" alt="src-content-blog.png" width="542" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating our blog posts
&lt;/h3&gt;

&lt;p&gt;Next, we will need to create some blog posts.&lt;/p&gt;

&lt;p&gt;For demonstration purposes, these blog posts will be very simple. The most important part is the Frontmatter, as we will soon learn how to make all of the data contained in it typesafe.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/content/blog/post-1.md&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Blog&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;post&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;1"&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;John Doe&lt;/span&gt;
&lt;span class="na"&gt;isDraft&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;publishedDate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;02-01-2023&lt;/span&gt;
&lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Web Development&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;JavaScript&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Astro&lt;/span&gt;
&lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://images.unsplash.com/photo-1555066931-4365d14bab8c?ixlib=rb-4.0.3&amp;amp;ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;amp;auto=format&amp;amp;fit=crop&amp;amp;w=1470&amp;amp;q=80&lt;/span&gt;
&lt;span class="na"&gt;canonicalURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://localhost:3000/blog/blog-post-1&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# Blog post 1&lt;/span&gt;

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum dignissim fermentum. Nunc eget semper dui. Fusce commodo placerat dictum. Curabitur nec mauris eu mi condimentum fermentum. Donec a magna accumsan, sodales leo consequat, venenatis ligula. Vivamus a pharetra est. Nam posuere dolor sed tortor suscipit, ac feugiat magna convallis.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;src/content/blog/post-2.md&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Blog post &lt;/span&gt;&lt;span class="m"&gt;2&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;John Doe&lt;/span&gt;
&lt;span class="na"&gt;isDraft&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;publishedDate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;02-01-2023&lt;/span&gt;
&lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Web Development&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;JavaScript&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Astro&lt;/span&gt;
&lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://images.unsplash.com/photo-1498050108023-c5249f4df085?ixlib=rb-4.0.3&amp;amp;ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;amp;auto=format&amp;amp;fit=crop&amp;amp;w=1472&amp;amp;q=80&lt;/span&gt;
&lt;span class="na"&gt;canonicalURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://localhost:3000/blog/blog-post-2&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# Blog post 2&lt;/span&gt;

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum dignissim fermentum. Nunc eget semper dui. Fusce commodo placerat dictum. Curabitur nec mauris eu mi condimentum fermentum. Donec a magna accumsan, sodales leo consequat, venenatis ligula. Vivamus a pharetra est. Nam posuere dolor sed tortor suscipit, ac feugiat magna convallis.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;src/content/blog/post-3.md&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Blog post &lt;/span&gt;&lt;span class="m"&gt;3&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;John Doe&lt;/span&gt;
&lt;span class="na"&gt;isDraft&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;publishedDate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;02-01-2023&lt;/span&gt;
&lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Web Development&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;JavaScript&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Astro&lt;/span&gt;
&lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://images.unsplash.com/photo-1537884944318-390069bb8665?ixlib=rb-4.0.3&amp;amp;ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;amp;auto=format&amp;amp;fit=crop&amp;amp;w=1470&amp;amp;q=80&lt;/span&gt;
&lt;span class="na"&gt;canonicalURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://localhost:3000/blog/blog-post-2&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# Blog post 3&lt;/span&gt;

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum dignissim fermentum. Nunc eget semper dui. Fusce commodo placerat dictum. Curabitur nec mauris eu mi condimentum fermentum. Donec a magna accumsan, sodales leo consequat, venenatis ligula. Vivamus a pharetra est. Nam posuere dolor sed tortor suscipit, ac feugiat magna convallis.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Defining our blog collection schema
&lt;/h3&gt;

&lt;p&gt;Now that we have some blog posts, we need to &lt;a href="https://docs.astro.build/en/guides/content-collections/#defining-a-collection-schema" rel="noopener noreferrer"&gt;define a collection schema&lt;/a&gt; for our blog content collection.&lt;/p&gt;

&lt;p&gt;Create a file called &lt;code&gt;config.ts&lt;/code&gt; inside of &lt;code&gt;src/content&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flkhl31be5y73bbia8487.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flkhl31be5y73bbia8487.webp" alt="config-ts.png" width="476" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We first need to import the &lt;a href="https://zod.dev/" rel="noopener noreferrer"&gt;Zod validation library&lt;/a&gt; and the &lt;code&gt;defineCollection()&lt;/code&gt; function from &lt;code&gt;Astro:content&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/content/config.ts&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;defineCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we &lt;a href="https://docs.astro.build/en/guides/content-collections/#defining-a-collection-schema" rel="noopener noreferrer"&gt;define the schema for the content collection&lt;/a&gt; we want to validate. In our case, we need to define a schema for our blog collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/content/config.ts&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;defineCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogCollection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineCollection&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;isDraft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;publishDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;canonicalURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;url&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;p&gt;First, we are creating a new constant called &lt;code&gt;blogCollection&lt;/code&gt; and using the &lt;code&gt;defineCollection&lt;/code&gt; function to define our schema.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogCollection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;defineCollection&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we pass the &lt;code&gt;defineCollection&lt;/code&gt; function an &lt;code&gt;object&lt;/code&gt; with a &lt;code&gt;schema&lt;/code&gt; property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;isDraft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;publishDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;canonicalURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;url&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;The schema property is an object containing all of the Frontmatter data in our blog posts with their respective types. This is how Astro can validate and ensure our Frontmatter is typesafe!&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;z&lt;/code&gt; object comes from the &lt;a href="https://zod.dev/" rel="noopener noreferrer"&gt;Zod&lt;/a&gt;, a TypeScript first schema validation library. Please &lt;a href="https://zod.dev/" rel="noopener noreferrer"&gt;check out their docs&lt;/a&gt; for more info.&lt;/p&gt;

&lt;p&gt;A couple of interesting things worth pointing out.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;publishDate&lt;/code&gt; is of type string, but we are also using the &lt;a href="https://zod.dev/?id=transform" rel="noopener noreferrer"&gt;.transform()&lt;/a&gt; method from Zod to transform it into a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" rel="noopener noreferrer"&gt;JavaScript Date object&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tags&lt;/code&gt; is an array of strings denoted by &lt;code&gt;z.array(z.string())&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;image&lt;/code&gt; is of type string and also optional. We can make any type optional by using the &lt;a href="https://zod.dev/?id=optional" rel="noopener noreferrer"&gt;.optional()&lt;/a&gt; method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By default, Zod makes everything required. You have to explicitly tell it when something is optional.&lt;/p&gt;

&lt;p&gt;Finally, we need to export our schema from our config file. Here is the entire &lt;code&gt;src/content/config.ts&lt;/code&gt; file in its entirety.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;defineCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogCollection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineCollection&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;isDraft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;publishDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;canonicalURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;url&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;collections&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;blog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;blogCollection&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;
  
  
  Querying our blog collection
&lt;/h2&gt;

&lt;p&gt;Now that we have defined our collection schema, we are ready to learn how to query our blog content collection and render its content.&lt;/p&gt;

&lt;p&gt;Update &lt;code&gt;src/pages/index.astro&lt;/code&gt; with the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="o"&gt;---&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogPosts&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;getCollection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;---&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;blogPosts&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, we import the &lt;a href="https://docs.astro.build/en/reference/api-reference/#getcollection" rel="noopener noreferrer"&gt;getCollection&lt;/a&gt; method from &lt;code&gt;astro:content&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we &lt;code&gt;await&lt;/code&gt; the &lt;a href="https://docs.astro.build/en/reference/api-reference/#getcollection" rel="noopener noreferrer"&gt;getCollection&lt;/a&gt; method, which retrieves all the items within a given content collection. Our collection is called “blog,” so we pass the name of our collection as a string to &lt;code&gt;getCollection()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogPosts&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;getCollection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we render our blog posts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;blogPosts&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;Now if you open your browser to &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;, you should see the following error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz8abuqoo3vol0gt8by5f.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz8abuqoo3vol0gt8by5f.webp" alt="schema-error.png" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our schema validation is working!&lt;/p&gt;

&lt;p&gt;The error states that &lt;code&gt;publishDate&lt;/code&gt; is required, but our Frontmatter has &lt;code&gt;publishedDate&lt;/code&gt;. Hopefully, you can now begin to see how powerful and useful having typesafe frontmatter is.&lt;/p&gt;

&lt;p&gt;We can solve this by updating our &lt;code&gt;src/content/config.ts&lt;/code&gt; like so.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;defineCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogCollection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineCollection&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;isDraft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;publishedDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt; &lt;span class="c1"&gt;// updated from publishDate&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;canonicalURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;url&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;collections&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;blog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;blogCollection&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;Now if you visit &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;, you should see the following.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvxa458sdfs8sp17s2yv.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvxa458sdfs8sp17s2yv.webp" alt="object-object.png" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can render our blog post content properly by updating &lt;code&gt;src/pages/index.astro&lt;/code&gt; with the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="o"&gt;---&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogPosts&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;getCollection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;---&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;blogPosts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`/blog/&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;slug&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&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;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;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;We use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="noopener noreferrer"&gt;.map()&lt;/a&gt; to iterate over each post inside our blog content collection to create a link for each blog post title.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcs7e02eod442fyvehw85.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcs7e02eod442fyvehw85.webp" alt="blog-posts-title-links.png" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you try and click on one of the titles, you will get a 404 error page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftddfrwtao5n73ltgqjj5.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftddfrwtao5n73ltgqjj5.webp" alt="404.png" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is happening because we have not told Astro how to create dynamic routes for each of our blog posts.&lt;/p&gt;

&lt;p&gt;Let’s do that now!&lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic routes from content collections
&lt;/h2&gt;

&lt;p&gt;Now that we have our blog posts on the home page, we need to tell Astro how to generate a route for every post with &lt;a href="https://docs.astro.build/en/core-concepts/routing/#dynamic-routes" rel="noopener noreferrer"&gt;dynamic routes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are unfamiliar with how dynamic routes work in Astro, please check read the docs: &lt;a href="https://docs.astro.build/en/core-concepts/routing/#dynamic-routes" rel="noopener noreferrer"&gt;https://docs.astro.build/en/core-concepts/routing/#dynamic-routes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, create a folder called &lt;code&gt;blog&lt;/code&gt; inside of the &lt;code&gt;src/pages&lt;/code&gt; directory. Inside the newly created &lt;code&gt;blog&lt;/code&gt; folder, create a file called &lt;code&gt;[slug].astro&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyejffbh4p10dffwrrdoh.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyejffbh4p10dffwrrdoh.webp" alt="slug-astro-file.png" width="546" height="794"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="o"&gt;---&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getStaticPaths&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogEntries&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;getCollection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;blogEntries&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;entry&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="na"&gt;params&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;entry&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;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;entry&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Astro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&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;Content&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;---&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, we are importing the &lt;code&gt;getCollection&lt;/code&gt; function from &lt;code&gt;astro:content&lt;/code&gt;. We learned about this function in the previous section, where we learned how to query for our blog collection content.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getCollection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;astro:content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we are exporting an async function called &lt;a href="https://docs.astro.build/en/reference/api-reference/#getstaticpaths" rel="noopener noreferrer"&gt;getStaticPaths()&lt;/a&gt; which Astro provides. This function is what Astro uses to generate dynamic routes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getStaticPaths&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;Inside &lt;code&gt;getStaticPaths()&lt;/code&gt;, we &lt;code&gt;await&lt;/code&gt; the &lt;code&gt;getCollection()&lt;/code&gt; function, which returns all of the posts from the blog content collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getStaticPaths&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogEntries&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;getCollection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog&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;Then, we use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="noopener noreferrer"&gt;.map()&lt;/a&gt; to iterate over the blog posts, returning an object with two properties.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The first is a &lt;code&gt;params&lt;/code&gt; property which contains the slug of our blog post. Astro expects the slug from each post since we named this file &lt;code&gt;[slug].astro&lt;/code&gt;.

&lt;ol&gt;
&lt;li&gt;By default, Astro will use the file name of each post for the slug, which in our case is &lt;code&gt;post-1&lt;/code&gt;, &lt;code&gt;post-2&lt;/code&gt;, and &lt;code&gt;post-3&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;The second property, &lt;code&gt;props&lt;/code&gt;, returns each blog post's content.
&lt;/li&gt;

&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getStaticPaths&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blogEntries&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;getCollection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;blogEntries&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;entry&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="na"&gt;params&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;entry&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;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;entry&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;p&gt;Finally, we get the data returned from the &lt;code&gt;getStaticPaths()&lt;/code&gt; function and render the blog content using a special &lt;a href="https://docs.astro.build/en/guides/markdown-content/#the-content-component" rel="noopener noreferrer"&gt;Content component&lt;/a&gt; provided by Astro.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&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;entry&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Astro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&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;Content&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;---&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if you visit &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; and click on one of the blog post titles, you should see the post’s content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgt0jtwy8j0szo40z93n.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgt0jtwy8j0szo40z93n.webp" alt="blog-post-1.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;We covered a lot of material in this tutorial, so let’s quickly recap everything you learned.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, you learned what content collections are.&lt;/li&gt;
&lt;li&gt;Next, you learned how to create a new Astro 2.0 project.&lt;/li&gt;
&lt;li&gt;Then, you learned how to define a collection schema.&lt;/li&gt;
&lt;li&gt;Then, you learned how to query the blog content collection to render each blog post onto the home page.&lt;/li&gt;
&lt;li&gt;Finally, you learned how to create dynamic routes for each blog post within the blog content collection.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>How to get experience as a new developer</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Tue, 27 Dec 2022 20:40:19 +0000</pubDate>
      <link>https://dev.to/howtocode_io/how-to-get-experience-as-a-new-developer-3mi8</link>
      <guid>https://dev.to/howtocode_io/how-to-get-experience-as-a-new-developer-3mi8</guid>
      <description>&lt;p&gt;Here are several ways for you to gain experience as a new developer, in no particular order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practice
&lt;/h2&gt;

&lt;p&gt;Practice is critical for almost anything, and coding is no different. Instead of watching another tutorial, put into practice the concepts you just learned to solidify your understanding. Most tutorials, books, and courses will give you opportunities to practice, and you should complete all of them. In addition to those, however, here are some more ways you can practice.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://exercism.org/" rel="noopener noreferrer"&gt;Exercism.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://codekata.com/" rel="noopener noreferrer"&gt;Codekata.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.codewars.com/" rel="noopener noreferrer"&gt;Codewars.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codingdojo.org/kata/" rel="noopener noreferrer"&gt;Coding Dojo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Projects
&lt;/h2&gt;

&lt;p&gt;An excellent way for you to get experience is by building projects. Once you can create more complex applications, you should put some of them in your GitHub profile, resume, and portfolio.&lt;/p&gt;

&lt;p&gt;Here are some links and resources to give you some project ideas.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://javascript30.com/" rel="noopener noreferrer"&gt;https://javascript30.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.frontendmentor.io/" rel="noopener noreferrer"&gt;https://www.frontendmentor.io/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/RealToughCandy/project-ideas-for-web-developers" rel="noopener noreferrer"&gt;Project ideas for web developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/florinpop17/app-ideas" rel="noopener noreferrer"&gt;Florin Pop - App ideas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.florin-pop.com/blog/2019/09/100-days-100-projects/" rel="noopener noreferrer"&gt;100 days 100 projects challenge&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Bonus
&lt;/h3&gt;

&lt;p&gt;Here is a list of free public APIs you can use to build your projects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/public-apis/public-apis" rel="noopener noreferrer"&gt;https://github.com/public-apis/public-apis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Freelancing
&lt;/h2&gt;

&lt;p&gt;Freelancing is one of the best ways to gain experience as a new developer. This is the approach I took when &lt;a href="https://www.howtocode.io/posts/how-i-taught-myself-how-to-code" rel="noopener noreferrer"&gt;teaching myself how to code&lt;/a&gt;. Instead of trying to make money, I was working for the experience I could put on my resume, which was more valuable than money.&lt;/p&gt;

&lt;p&gt;People will not pay you very much when you are just starting and have little experience. When you start out, your skills are not worth much because you don’t have any yet. This will change over time as you get better and gain more experience.&lt;/p&gt;

&lt;p&gt;We all have to start somewhere.&lt;/p&gt;

&lt;p&gt;Here are some ideas to get you started freelancing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;See if you can help a family member’s business or friend.&lt;/li&gt;
&lt;li&gt;Churches usually have outdated websites that need a lot of work. Offer to work on their website for free, and I doubt they will say no.&lt;/li&gt;
&lt;li&gt;Restaurants notoriously have horrendous websites. Ask if you can rebuild the website for a local restaurant in your area.&lt;/li&gt;
&lt;li&gt;Look at the websites for various small businesses in your area. Ask the owner if you can rebuild, update, optimize, etc.&lt;/li&gt;
&lt;li&gt;Remember, it’s hard for anyone to say no when you offer free work, as they have nothing to lose.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Freelance Websites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.upwork.com/" rel="noopener noreferrer"&gt;Upwork&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fiverr.com/" rel="noopener noreferrer"&gt;Fiverr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://replit.com/site/bounties" rel="noopener noreferrer"&gt;Replit Bounties&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Freelance Tech &amp;amp; Tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://wordpress.org/" rel="noopener noreferrer"&gt;WordPress&lt;/a&gt; is the most popular CMS in the world. If you are freelancing, you have to know it.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.shopify.com/" rel="noopener noreferrer"&gt;Shopify&lt;/a&gt; is one of the most popular e-commerce platforms in the world. If you want to do e-commerce, you need to know it.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.squarespace.com/" rel="noopener noreferrer"&gt;Squarespace&lt;/a&gt; is also incredibly popular as it allows you to build beautiful websites and stores without coding.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Open source
&lt;/h2&gt;

&lt;p&gt;The best way to gain real-world experience is by doing open-source work. This can be incredibly intimidating initially, but the payoff is well worth it.&lt;/p&gt;

&lt;p&gt;When you are just starting, the best way to get started is by submitting PRs (pull requests) with fixes for typos, grammar, broken links, and things like that. This requires little to no skill and involves you in the open-source community. Maintainers always appreciate when people correct mistakes or broken links in their docs.&lt;/p&gt;

&lt;p&gt;If you are brand new and have never created a PR, or you don’t even know what that means, take this free course to learn how GitHub, PRs, and open source work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github" rel="noopener noreferrer"&gt;How to Contribute to an Open Source Project on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some ways to get started in open source:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As I mentioned, submit fixes to documentation sites for typos, grammar, and broken links.&lt;/li&gt;
&lt;li&gt;Look at the issues tab on any GitHub repo for beginner-friendly issues. Lots of repos on GitHub will label beginner-friendly issues with things like “first-time contributor.”&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/MunGell/awesome-for-beginners" rel="noopener noreferrer"&gt;A list of awesome beginners-friendly projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/a-practical-guide-to-start-opensource-contributions/" rel="noopener noreferrer"&gt;Open Source for Developers – A Beginner's Handbook to Help You Start Contributing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.firsttimersonly.com/" rel="noopener noreferrer"&gt;First Timers Only - a list of open source projects for newbies&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hackathons
&lt;/h2&gt;

&lt;p&gt;Hackathons are another great way to gain experience as a new developer. They may seem intimidating at first, but many hackathons are beginner friendly and welcoming.&lt;/p&gt;

&lt;p&gt;A lot of them are virtual nowadays, too, since Covid.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mlh.io/" rel="noopener noreferrer"&gt;Major League Hacking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devpost.com/" rel="noopener noreferrer"&gt;Devpost&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hackerearth.com/challenges/hackathon/" rel="noopener noreferrer"&gt;Hacker Earth&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hackathon.com/" rel="noopener noreferrer"&gt;Hackathon.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devfolio.co/hackathons" rel="noopener noreferrer"&gt;Devfolio&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Internships
&lt;/h2&gt;

&lt;p&gt;Some companies offer internships which can be another great option to get your foot in the door and gain real experience. I don’t suggest doing an internship for free. The company should be paying you for your time. The nice thing about internships is that the company will typically offer you a full-time position if they like working with you during the internship.&lt;/p&gt;

&lt;p&gt;It is a great way to get experience and land your first job too.&lt;/p&gt;

</description>
      <category>devmeme</category>
    </item>
    <item>
      <title>How to Create Developer Screencasts with Keynote</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Fri, 06 May 2022 13:44:06 +0000</pubDate>
      <link>https://dev.to/howtocode_io/how-to-create-developer-screencasts-with-keynote-2j9b</link>
      <guid>https://dev.to/howtocode_io/how-to-create-developer-screencasts-with-keynote-2j9b</guid>
      <description>&lt;p&gt;In this article, I will show you how I create screencasts for developers using Keynote.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;None&lt;/strong&gt; of the links in this article are affiliate links.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I use a Mac, so all of the information and software mentioned in this article will be specific to Mac.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Screencast Examples
&lt;/h2&gt;

&lt;p&gt;Before explaining the methods, tools, and techniques I use to create these screencasts, I thought it would be helpful to share a few examples. Please watch them to determine if this is something you are interested in learning more about.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/USX6AntcPyg"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/N0TOFWy1Xvg"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Fohrq5GZSD8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Now that you have seen a few examples let’s break down the steps involved in creating them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing the Script
&lt;/h2&gt;

&lt;p&gt;The first thing I do is write the script that I will read when recording the screencast. A script helps me clarify my thoughts and serves as an outline of all the topics I wish to discuss. Writing is thinking aloud, so by having a script, I am confident that I won’t forget something or leave a critical point out.&lt;/p&gt;

&lt;p&gt;One of the nice things about having a script is that you know precisely what you will say. Improvising or “just winging it” often wastes a lot of time and makes editing more difficult.&lt;/p&gt;

&lt;p&gt;Once the script is complete, I split the script into multiple parts or sections. Each section will be a separate video. I do this because it allows me to record most of the videos in a single take, which is more natural. I do not enjoy editing videos, so anything I can do to minimize it is better.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Script
&lt;/h3&gt;

&lt;p&gt;In the video below, I broke the script into nine different sections.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Fohrq5GZSD8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Here is what the script looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ODD2Vtbu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/script-example.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ODD2Vtbu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/script-example.png" alt="Screencast Script Example" width="880" height="1467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I use Notion for all of my scripts. One of the nice things about using Notion is that it allows me to drag and drop sentences and ideas around as I shape the script. I also like it because it keeps everything in sync across all of my devices, as I usually read the script from my iPhone or iPad while recording. Keynote blacks out all external monitors while presenting, so I use my phone or iPad instead.&lt;/p&gt;

&lt;p&gt;I will often make notes for myself within the script to remind myself of things I need to do. For example, I will often remind myself of the name of the keynote file I need to use for that section, when I need to advance the next slide, etc.&lt;/p&gt;

&lt;p&gt;Once the script is complete, I then begin working on the slides.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the Slides
&lt;/h2&gt;

&lt;p&gt;This is the most time-intensive part of the process, especially if you are new to Keynote. Since I am making screencasts for developers, I will often have many code examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  Highlighting &amp;amp; Animating Code Examples
&lt;/h3&gt;

&lt;p&gt;One of the main reasons I like using Keynote for code examples is that I can highlight and draw the viewer's attention to specific areas or lines in the code. I learned this technique from the guys over at &lt;a href="http://Egghead.io"&gt;Egghead.io&lt;/a&gt;. They have an excellent video that goes in-depth on how to highlight and animate code &lt;a href="https://egghead.io/lessons/egghead-animate-and-highlight-code-in-keynote-presentations"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Animations with Keynote
&lt;/h3&gt;

&lt;p&gt;Keynote also contains an incredibly powerful animation engine that allows you to create animations with relative ease. The most important animation tool within Keynote that you want to learn is “Magic Move.” You can find out more about how to create animations in Keynote from this &lt;a href="https://www.youtube.com/watch?v=PquHTf4psCs"&gt;awesome video by Sam Julien.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also “reverse engineer” the animations in the slides I used in the example videos above to better understand how to create animations in Keynote. Here are links to download the keynote files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/DX-Template-for-Screencasts.key"&gt;DX-Template-for-Screencasts.key&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/CI-Intro.key"&gt;CI-Intro.key&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Workflows-Actions.key"&gt;Workflows-Actions.key&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/6-session-origin-spec.key"&gt;6-session-origin-spec.key&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first file, “DX-Template for Screencasts,” contains several template slides that I use regularly. It includes slides that mimic a terminal, VSCode, etc., so I don’t have to reinvent the wheel. Feel free to use these in your videos if you like.&lt;/p&gt;

&lt;h2&gt;
  
  
  Audio &amp;amp; Mics
&lt;/h2&gt;

&lt;p&gt;Audio is one of the most important aspects of making videos, not just screencasts but any video. People can put up with a lower quality resolution, but they will NOT tolerate lousy audio, so getting your sound right is critical.&lt;/p&gt;

&lt;p&gt;I use the &lt;a href="https://www.bluemic.com/en-us/products/yeti/"&gt;Blue Yeti&lt;/a&gt; microphone, and it works pretty well. The problem with using it or any condenser microphone is how sensitive they are. Unless you are in an acoustically treated room, they will pick up all kinds of sounds and vibrations around you. If you don’t already own a mic, I recommend you use the &lt;a href="http://www.samsontech.com/samson/products/microphones/usb-microphones/q2u/"&gt;Samson Q2U&lt;/a&gt;, a dynamic microphone that sounds excellent. Dynamic mics are less sensitive than condenser mics, so you won’t have to worry as much about room sounds or sounds outside of our room like lawnmowers, leaf blowers, cars, etc.&lt;/p&gt;

&lt;p&gt;Regardless of the mic, it would be best to get your mouth as close to it as possible. You want the mic as close to your mouth as possible for the best quality sound.&lt;/p&gt;

&lt;p&gt;You may also want to invest in a &lt;a href="https://www.amazon.com/Microphone-Flexible-Gooseneck-Stabilizing-Earamble/dp/B06WVFRW4H"&gt;pop filter&lt;/a&gt; to protect your mic from picking up explosive sounds like when you make “p” sounds or “s” sounds with your voice.&lt;/p&gt;

&lt;p&gt;If you don’t already have a mic, make sure to buy one that you can hook up to your computer via USB. Otherwise, you will have to purchase mic cables and an audio interface to hook up the mic to your computer, which is frankly overkill and unnecessary for screencasts. I have been a musician for over 20 years and already own a bunch of audio equipment, and I still use a mic with a USB connection for its convenience and because the audio quality is just as good.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recording
&lt;/h2&gt;

&lt;p&gt;Now that the script and the slides are complete, it is time to record. I use &lt;a href="http://www.telestream.net/screenflow/overview.htm"&gt;Screenflow&lt;/a&gt; to record all of my screencasts. I also use a tool called &lt;a href="https://www.madrau.com/"&gt;SwitchResX&lt;/a&gt;, which allows me to change the resolution of my monitors to whatever I want. Being able to control the resolutions of my monitors is essential for making screencasts. I always record at the following resolution.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;1280x720, 60Hz HiDPI 16:9&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will record at 720 but with double the number of pixels, so when I later export from Screenflow, I can export at double the resolution. Recording at 720 makes everything large enough, and the HiDPI resolution provides plenty of pixels, so everything is crisp and clear.&lt;/p&gt;

&lt;p&gt;When I am about to record, I press play in Keynote to start the presentation, and then I press my keyboard shortcuts to start the Screenflow recording and record the video.&lt;/p&gt;

&lt;p&gt;I name each file for each video something like “video-1.screenflow", “video-2.screenflow,” etc. The numbers correlate to the numbers in my script, like in the example above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making Mistakes
&lt;/h2&gt;

&lt;p&gt;It would be best if you accepted that you will make mistakes and say stupid things when recording. This is normal and will improve over time with lots of practice. What I like to do when I say the wrong thing, cough, breathe loud, etc., is to take a long pause while still recording and say that sentence or part over again. I rarely ever stop the recording, as I can edit and delete all the bad takes afterward.&lt;/p&gt;

&lt;p&gt;Another important thing to note is that once you have finished recording the video, watch the entire thing immediately afterward to make sure you have all that you need. I used to record all of the sections without immediately reviewing them, only to find out that my audio was terrible or something else and had to re-record everything. Please don’t make the same mistakes as me. So once you have finished recording, make sure to watch and listen to it immediately to ensure everything looks and sounds good, then move on to the next video.&lt;/p&gt;

&lt;h2&gt;
  
  
  Editing
&lt;/h2&gt;

&lt;p&gt;Now that you have recorded all of the sections of your video, you need to start editing. Open the first video and immediately save it as “video-1-edited.screenflow” or something similar. I always immediately save a copy and denote “edited” in the file name. This way, I have a copy of the original unedited version and the edited version. I do this because sometimes I make bad edits or mistakes that I cannot undo. I cannot tell you how many times I have done this and had to redo the recording again. This way, you will have a copy of the original to revert to if you make a mistake during the editing process.&lt;/p&gt;

&lt;p&gt;I would highly recommend you do this, especially if you are brand new. You will thank me later.&lt;/p&gt;

&lt;p&gt;I can’t go into great detail on how to edit videos in Screenflow. There are tons of helpful videos on YouTube that will help you, but for the most part, it is very straightforward. You don’t need to know a whole lot, just the basics like how to cut, trim, transition, etc. Screenflow makes all of this very easy for you.&lt;/p&gt;

&lt;p&gt;The first thing you need to do is create a new ScreenFlow project that contains all of your videos. I typically duplicate the “video-1.screenflow” file and rename it to the name of the screencast, like “cypress-origin-api.screenflow.” Then I open each screenflow project, copy the audio and video tracks and paste them into the “cypress-origin-api.screenflow” project, or whatever you named your project. After going through each one, you should have all the video and audio tracks combined into a single ScreenFlow project.&lt;/p&gt;

&lt;p&gt;Next, before I start editing, I adjust the audio. Take a look at this screenshot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PWKOXeMe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.47.01_AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PWKOXeMe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.47.01_AM.png" alt="" width="880" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You want to select &lt;strong&gt;all of the audio tracks&lt;/strong&gt; and then click on the speaker icon in the right sidebar. Check the “Smooth Volume Levels” checkbox and the “Remove Background Noise” checkbox. You can adjust how much background adjustment is necessary with the slider below it. This will help to make your audio levels sound consistent.&lt;/p&gt;

&lt;p&gt;After adjusting the audio, I begin to trim, edit, delete, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ripple Delete
&lt;/h3&gt;

&lt;p&gt;One technique that is a game-changer for editing in Screenflow is something called Ripple Delete. It will significantly cut down the amount of time you spend editing.&lt;/p&gt;

&lt;p&gt;You can watch this video to learn it: &lt;a href="https://www.youtube.com/watch?v=QGvqMS3OUuQ"&gt;How to Ripple Delete&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recut
&lt;/h3&gt;

&lt;p&gt;Another tool that I have heard a lot of great things about, but have yet to use myself is &lt;a href="https://getrecut.com/"&gt;Recut&lt;/a&gt;. Check it out and see if it helps you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Descript
&lt;/h3&gt;

&lt;p&gt;Another tool we use a lot at work is called &lt;a href="https://www.descript.com/"&gt;Descript&lt;/a&gt;. It is a great tool for editing and collaborating on screencasts. What makes it really powerful is the ability of its AI to learn your voice. This allows you to easily fix misspoken words, sentences, phrases, etc. All you have to do is highlight that word(s) in descript, type out the correct word(s) and Descript will use your own voice to correct it. It sounds incredibly realistic.&lt;/p&gt;

&lt;p&gt;A tool like this is by no means essential, but it does come in handy. It is worth looking into if you are going to be making a lot of screencasts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exporting
&lt;/h2&gt;

&lt;p&gt;Once you are finished editing and are satisfied with the screencast, it is time to export. Here are the settings I use when exporting.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1obPz3vp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.58.31_AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1obPz3vp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.58.31_AM.png" alt="" width="880" height="845"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure you select the “Type: Manual” and select the “customize” button. Here are the custom settings I use in that menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QGZ_iHY0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.58.20_AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QGZ_iHY0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.58.20_AM.png" alt="" width="862" height="1006"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A8CLfxIt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.58.31_AM%25201.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A8CLfxIt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/how-to-create-developer-screencasts-with-keynote/Screen_Shot_2022-05-05_at_10.58.31_AM%25201.png" alt="" width="880" height="845"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that the resolution is set to &lt;code&gt;2560x1440&lt;/code&gt;, which is 100% the original. I record at HiDPI because it gives you double the number of pixels.&lt;/p&gt;

&lt;p&gt;I also always uncheck the “Letterbox Content” checkbox.&lt;/p&gt;

&lt;p&gt;Finally, click “Export.”&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;This article went over how I create developer screencasts with Keynote. I tried to be as detailed and specific as possible, as the devil is really in the details with this kind of thing. If you found this helpful and use any of these ideas or techniques in your screencasts, I would love to see them. Please share them with me on &lt;a href="https://twitter.com/howtocode_io"&gt;Twitter&lt;/a&gt; or send me an email. All of my contact info is in the footer.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introducing Real World Testing with Cypress</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Mon, 18 Apr 2022 13:55:38 +0000</pubDate>
      <link>https://dev.to/howtocode_io/introducing-real-world-testing-with-cypress-1kc1</link>
      <guid>https://dev.to/howtocode_io/introducing-real-world-testing-with-cypress-1kc1</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://learn.cypress.io"&gt;Real World Testing with Cypress&lt;/a&gt; (RWT) is a four-course curriculum that teaches everything you need to know about testing modern web applications with Cypress.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Will Learn
&lt;/h2&gt;

&lt;p&gt;The curriculum contains four courses and over 25 lessons.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Testing Your First Application
&lt;/h3&gt;

&lt;p&gt;How to test a simple TodoMVC app with Cypress.&lt;/p&gt;

&lt;p&gt;First, we teach you how to test a simple TodoMVC application with Cypress. We thought it would be best for you to “get your hands dirty” right away.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Testing Foundations
&lt;/h3&gt;

&lt;p&gt;The foundations you need to write great tests.&lt;/p&gt;

&lt;p&gt;Next, we teach you the foundational knowledge you need to write great tests. We cover topics like “testing mindset,” knowing what to test, the difference between manual and automated testing, the differences between unit, integration and end-to-end tests, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Cypress Fundamentals
&lt;/h3&gt;

&lt;p&gt;Absolute fundamentals of Cypress you must know to be successful&lt;/p&gt;

&lt;p&gt;Then we cover Cypress fundamentals, which go over all of the important Cypress-specific knowledge you need to write the best tests possible with Cypress. Even if you have been using Cypress for years, I promise there will be some gold nuggets in there.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Advanced Cypress Concepts
&lt;/h3&gt;

&lt;p&gt;Advanced Cypress concepts to take your tests to the next level.&lt;/p&gt;

&lt;p&gt;Finally, we cover advanced Cypress concepts. In this course, we teach you how to initialize and seed your database for testing, how to run tests in CI, how to test network requests, how to build custom Cypress commands, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real World Examples
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OgZ9sxvb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/cypress-real-world-testing/overview.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OgZ9sxvb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/cypress-real-world-testing/overview.png" alt="" width="880" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition, we have also prepared over 30+ examples of real-world tests against the &lt;a href="https://github.com/cypress-io/cypress-realworld-app"&gt;Real World App&lt;/a&gt;. This application has been around for a couple of years now, but since it contains some rather advanced concepts and examples, much of it was beyond reach for people just getting started. To solve this problem we have written in-depth articles for every example which explains line by line what each test is doing.&lt;/p&gt;

&lt;p&gt;These examples put into practice all of the principals and concepts explained within the curriculum.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tutorials
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rIQOcqVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/cypress-real-world-testing/Screen_Shot_2021-12-16_at_10.04.09_AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rIQOcqVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.howtocode.io/images/cypress-real-world-testing/Screen_Shot_2021-12-16_at_10.04.09_AM.png" alt="" width="880" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, we aim to demonstrate how to test more real-world applications against various technologies and providers.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Build and Test a Next.js and Shopify Store
&lt;/h3&gt;

&lt;p&gt;In this six-part tutorial, we teach you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to create a Shopify partners store&lt;/li&gt;
&lt;li&gt;How to create a custom front-end for your store with Next.js,&lt;/li&gt;
&lt;li&gt;How to test the app with Cypress&lt;/li&gt;
&lt;li&gt;How to run your tests in CI with GitHub Actions&lt;/li&gt;
&lt;li&gt;How to run your tests in parallel with the Cypress Dashboard&lt;/li&gt;
&lt;li&gt;How to deploy your app to production on Vercel&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Contributing
&lt;/h2&gt;

&lt;p&gt;The curriculum is open source and can be found on &lt;a href="https://github.com/cypress-io/cypress-realworld-testing"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What is Zettelkasten?</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Sat, 14 Aug 2021 19:36:14 +0000</pubDate>
      <link>https://dev.to/howtocode_io/what-is-zettelkasten-k6</link>
      <guid>https://dev.to/howtocode_io/what-is-zettelkasten-k6</guid>
      <description>&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@qwitka?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Maksym Kaharlytskyi&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/filing-cabinet?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;The word Zettelkasten is a German word that means "slip box." However, it is commonly used to refer to a system of note-taking, which was popularized by a German Sociologist name Niklas Luhmann.&lt;/p&gt;

&lt;p&gt;During his lifetime, Luhmann created over 90,000 notes in his Zettelkasten which allowed him to publish over 50 books and over 600 articles. His estate also contains over 150 unfinished manuscripts, one of which is over 1,000 pages long.&lt;/p&gt;

&lt;p&gt;So what exactly is a Zettelkasten and how does it work?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Zettelkasten Method
&lt;/h2&gt;

&lt;p&gt;Luhmann's Zettelkasten and note-taking method is rather simple which is what makes it so profound. Here is how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Capture a single thought, in your own words, in a single note. The goal here is to make sure that the note has all of the context you need so that you will understand it at a later point in time, without needing to look up the source of where it came from.&lt;/li&gt;
&lt;li&gt;Link this note with other notes within your Zettelkasten system. Herein, lies the key and the secret of the entire system and method. What makes a Zettelkasten powerful, is not the notes themselves, but &lt;em&gt;their relationship to one another&lt;/em&gt;. You can think of this like hypertext on the web, where one page links to another. This system of linking notes mimics what our brains naturally do, i.e &lt;a href="https://en.wikipedia.org/wiki/Neuroplasticity"&gt;Neuroplasticity&lt;/a&gt;. The Zettelkasten becomes a "second brain" that you build externally to yourself.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now let's learn how we can create one.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create your own Zettelkasten
&lt;/h2&gt;

&lt;p&gt;I am going to be describing my process, which is not necessarily the "right way." Truth be told, there really isn't one. The most important thing is that you find a process that works for you. You are building your own personal knowledge management system, aka a "second brain" for yourself, so feel free to adapt and modify the method to suite your own needs.&lt;/p&gt;

&lt;p&gt;I will be describing my method in the context of taking notes on a book, but my process is identical for any medium.&lt;/p&gt;

&lt;h2&gt;
  
  
  Literature Notes
&lt;/h2&gt;

&lt;p&gt;Before I begin reading the book I will create a new note in &lt;a href="https://obsidian.md/"&gt;Obsidian&lt;/a&gt;. This new note will be considered a "literature note." A literature note is simply a note where I capture my own thoughts about something that I am reading in the book. The key here is not to copy and paste or write down verbatim, a passage or sentence from the book. The intent is to take the time to really think about this thought, internalize it, and write it down in my own words. Once I have captured the thought or idea in my own words, I move on and keep reading. I continue this process of taking notes until I finish reading the book.&lt;/p&gt;

&lt;p&gt;By the end of the book I will have several notes of my own thoughts and ideas, from various concepts I learned from the book.&lt;/p&gt;

&lt;h3&gt;
  
  
  Confession &amp;amp; Full Transparency
&lt;/h3&gt;

&lt;p&gt;There are times when an author's words are so well written and perfectly encapsulate an idea that I cannot possibly word it any better. In that case, I capture the idea as a quote, and make sure I know that it is a quote and not my own thinking. I will also make note of the page number to reference where this quote came from.&lt;/p&gt;

&lt;h2&gt;
  
  
  Permanent Notes
&lt;/h2&gt;

&lt;p&gt;So now that the book is finished and I have a single "literature note" with lot's of notes, ideas, quotes, etc. I then review all of these thoughts and ideas and determine which ones I would like to turn into "permanent notes."&lt;/p&gt;

&lt;p&gt;Permanent notes are atomic.&lt;/p&gt;

&lt;p&gt;Atomic means they contain all of the context necessary to understand the thought or idea, without needing to look up the source from which it came from. The meaning is self-contained within the note itself.&lt;/p&gt;

&lt;p&gt;So which notes become permanent notes?&lt;/p&gt;

&lt;p&gt;Permanent notes are thoughts or ideas that I feel are important and do not want to forget. Once I find a thought or idea from my literature note that I want to turn into a permanent note, I will create a brand new note for it.&lt;/p&gt;

&lt;p&gt;I will typically expand upon the idea to make sure it encapsulates the context and everything it needs to be understood by me in the future. I don't write more than a couple of paragraphs typically.&lt;/p&gt;

&lt;p&gt;The goal here is not to write a lot of words, simplicity and brevity are key. Write down the minimum amount of information needed to capture the idea so it can be understood on its own, by you, at some point in the future.&lt;/p&gt;

&lt;p&gt;Here is an example of one of my permanent notes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# We often mask our lack of understanding using complicated vocabulary and jargon&lt;/span&gt;

The use of complicated and/or sophisticated language is often used to hide the fact that we do not fully understand what we are talking about. Being able to speak in simple vocabulary, use simple illustrations, etc., demonstrates our full comprehension of a subject.

If we can explain our subject to a child, then this is a good indicator that we do not have any gaps in our understanding.
&lt;span class="gt"&gt;
&amp;gt; If you require complicated terminology to explain what you know, you have no flexibility. When someone asks you a question, you can only repeat what you’ve already said.&lt;/span&gt;
&lt;span class="gt"&gt;&amp;gt; -- https://fs.blog/2021/02/feynman-learning-technique/&lt;/span&gt;

See: [[Perfection is achieved when there is nothing left to take away]]
&lt;span class="p"&gt;
---
&lt;/span&gt;
Date: 2021-06-02
Status: #permanent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Linking Notes
&lt;/h2&gt;

&lt;p&gt;In the example above you will notice a link, &lt;code&gt;[[Perfection is achieved when there is nothing left to take away]]&lt;/code&gt; which links to another note within my Zettelkasten.&lt;/p&gt;

&lt;p&gt;This is what that note looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Perfection is achieved when there is nothing left to take away&lt;/span&gt;
&lt;span class="gt"&gt;
&amp;gt; Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.&lt;/span&gt;
&lt;span class="p"&gt;
---
&lt;/span&gt;
Author: Antoine de Saint-Exupéry
Source: Airman’s Odyssey. https://www.goodreads.com/work/best_book/11753-airman-s-odyssey.
Type: #quote
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the power of using the Zettelkasten method. By linking notes together, you are creating new connections and pathways between various types of information and thought — and remember, these are your own thoughts.&lt;/p&gt;

&lt;p&gt;As you begin to add more notes into your Zettelkasten the connections between those notes grows. The more you put into your Zettelkasten the more you get out of it. This is why Luhmann's Zettelkasten of over 90,000 notes allowed him to write as many books and articles as he did.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Goal of a Zettelkasten is writing
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;I only do what is easy. I only write when I immediately know how to do it, if I falter for a moment, I put the matter aside and do something else&lt;br&gt;
-- Niklas Luhmann from "How to take Smart Notes" by Sönke Ahrens page 15&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When Luhmann began to write a new article or book, he would simply open his Zettelkasten and follow the links between his notes. He would then take all of the notes that made the most sense for his subject and use them as his outline and first draft.&lt;/p&gt;

&lt;p&gt;His Zettelkasten provided the framework for his new projects which meant he &lt;strong&gt;never started from a blank page&lt;/strong&gt;. He had a vast collection of thousands of notes from which he could draw inspiration, insight, and inquiry — all of these insights from his Zettelkasten were his own thoughts. After writing his first draft, he would then do further research to fill in any gaps in his arguments and then publish.&lt;/p&gt;

&lt;p&gt;Luhmann would typically work on several books at the same time, which is why he was so prolific as an author. Working on multiple projects also kept him from ever getting "stuck." Listen to what he would do, in his own words, whenever he was felt stuck:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I always work on different manuscripts at the same time. With this method, to work on different things simultaneously, I never encounter any blockages.&lt;br&gt;
-- Niklas Luhmann from "How to take Smart Notes" by Sönke Ahrens page 141&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Resources for learning more
&lt;/h2&gt;

&lt;p&gt;This article really only scratches the surface as the proverbial "rabbit hole" goes quite deep when it comes to Zettelkasten, Personal Knowledge Management, Building a Second brain, etc. If you want to take the "red pill" and go deeper, here are some great resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://zettelkasten.de/introduction/#luhmann-s-zettelkasten"&gt;https://zettelkasten.de/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.amazon.com/How-Take-Smart-Notes-Nonfiction-ebook/dp/B06WVYW33Y"&gt;How to Take Smart Notes by Sönke Ahrens&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://notes.andymatuschak.org/Evergreen_notes"&gt;Andy Matuschak's Notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UC85D7ERwhke7wVqskV_DZUA"&gt;YouTube - Linking Your Thinking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCfhSB16X9MXhzSFe_H7XbHg"&gt;YouTube - Bryan Jenks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://forum.obsidian.md/"&gt;Obsidan Forums&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to manage your expectations while teaching yourself how to code</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Tue, 10 Aug 2021 12:56:58 +0000</pubDate>
      <link>https://dev.to/howtocode_io/how-to-manage-your-expectations-while-teaching-yourself-how-to-code-47pn</link>
      <guid>https://dev.to/howtocode_io/how-to-manage-your-expectations-while-teaching-yourself-how-to-code-47pn</guid>
      <description>&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@franzharvin?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Franz Harvin Aceituna&lt;/a&gt; on &lt;a href="https://unsplash.com/@franzharvin?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Programming is hard. Don't let anyone tell you otherwise. This profession is not easy. Teaching yourself how to code, especially when you have no prior experience, can feel daunting and overwhelming. This is why one of the most important lessons you can learn before you begin this journey is to embrace being a beginner.&lt;/p&gt;

&lt;h2&gt;
  
  
  You will be terrible at first and that's ok
&lt;/h2&gt;

&lt;p&gt;When you are first learning something, you typically are quite terrible at it. In fact, most of us struggle for quite some time when first learning a new skill, language, subject, instrument, etc. However, for some strange reason, people teaching themselves how to code completely miss this.&lt;/p&gt;

&lt;p&gt;When you are first learning how to code, you really have no idea what you are doing. Am I doing this right? Should I take this tutorial or that one? Should I take both? Which one should I take first? Should I go to a boot camp? How do I find a mentor? How much do I need to know before I get my first job? The questions are endless, and that's expected, because you don't know what you're doing.&lt;/p&gt;

&lt;p&gt;Embrace not knowing.&lt;/p&gt;

&lt;p&gt;You must learn to embrace being a beginner when teaching yourself how to code. You are going to get stuck a lot! You are going to make tons of mistakes, you will do so many things "wrong." Here is the reality of it all though...&lt;/p&gt;

&lt;p&gt;You are supposed to get stuck, make mistakes and do the wrong things over and over again. This is called learning, the very thing you set out to do.&lt;/p&gt;

&lt;p&gt;Embrace being a beginner.&lt;/p&gt;

&lt;p&gt;When you are learning to program, you are exposing yourself to many new concepts that at first seem completely foreign to you, and that's because they are. If these concepts were not foreign then you wouldn't be learning anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managing Expectations
&lt;/h2&gt;

&lt;p&gt;One of the most valuable lessons I learned while on this journey, and frankly before I even started, was knowing how to manage my expectations. You see prior to teaching myself how to code I taught myself how to play guitar at the age of 14. I didn't have any lessons, all I had was a guitar, the internet and an incredible desire to play. I practiced for hours and hours each and every day, and it took me about one year to become a "bad" guitar player.&lt;/p&gt;

&lt;p&gt;Let that sink it for a moment. One year of practicing virtually every single day for several hours made me a bad guitar player. I could have just given up right then and there and said this is not for me, clearly I don't have any talent for this. Maybe I did, maybe I didn't, maybe I still don't, who knows.&lt;/p&gt;

&lt;p&gt;The point, however, is that I never gave up. I kept practicing.&lt;/p&gt;

&lt;p&gt;All of that practice finally paid off when I was accepted to Berklee College of Music at the age of 24. I was accepted as a bass player and managed to teach myself that instrument too, without any private lessons as well. I couldn't read music, I didn't know what scales were or key signatures for that matter, but I could play. I played countless shows in various bands and practiced for countless hours over those 10 years.&lt;/p&gt;

&lt;p&gt;I embraced being a beginner because I knew that at some point I no longer would be.&lt;/p&gt;

&lt;h2&gt;
  
  
  You are not too old and yes you are smart enough
&lt;/h2&gt;

&lt;p&gt;A common question that I see come up again and again is, "I am x years old, am I too old to program?" No. It doesn't matter how old you are.&lt;/p&gt;

&lt;p&gt;The real question is how badly do you want to program? If you want it and are willing to work hard for it, you will get it, the same holds true for most things in life.&lt;/p&gt;

&lt;p&gt;Hard work wins.&lt;/p&gt;

&lt;p&gt;Don't be like me and think that you need to have a PhD from MIT in mathematics or physics in order to do this, you don't. I have been a full-time developer for over six years now and I have used very little math in my day to day work. Obviously this will vary depending upon the type of programming you are doing, but don't let it stop you. If you need better math skills, then you will learn those skills too, as needed. That "as needed" part is key, by the way.&lt;/p&gt;

&lt;p&gt;You only need to know enough to get the job done, you don't have to know it all.&lt;/p&gt;

&lt;h2&gt;
  
  
  You are always learning
&lt;/h2&gt;

&lt;p&gt;Another misconception many people have when teaching themselves to code is that they have to have it all figured out before they can apply for their first job. I got my first junior developer job after five months of teaching myself how to code. I had no idea what I was doing, however, I knew I would grow into the role over time.&lt;/p&gt;

&lt;p&gt;You need to realize this too, and the sooner the better.&lt;/p&gt;

&lt;p&gt;You are always learning in this field and you always will be. Things change all the time and that is what makes it fun. Sure we get paid a lot of money to do this, but you will be absolutely miserable if you are not comfortable with being put into challenging situations and asked to solve problems you have never seen before on a daily basis.&lt;/p&gt;

&lt;p&gt;Developers who have been at this for a very long time are still learning and believe it or not they can still learn things for you, even if you are just a junior developer. Everyone's experience is unique and everyone has something unique to offer, don't think you don't simply because you are new.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leverage what you have
&lt;/h2&gt;

&lt;p&gt;If I am being completely honest, the real reason I was hired at that company was because of my degree in music, as Berklee is a well respected school. The company that hired me was a music company and they were willing to take a chance on me because of my degree in music, not because of my programming skills.&lt;/p&gt;

&lt;p&gt;This is something you should be thinking about too. You may not have a lot of experience in programming just yet, but what do you have experience with? If you have experience in retail then try to get a developer job working for a retail company, maybe working on their e-commerce store. If you have experience teaching, then try to get a developer job at a software company in the education space.&lt;/p&gt;

&lt;p&gt;Leverage what you already have instead of trying to start from scratch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap Up
&lt;/h2&gt;

&lt;p&gt;The sooner you learn to embrace being a beginner the more effective your learning will be. If you can learn to manage your expectations before you even begin to teach yourself how to code, you will be less likely to give up. You will already be anticipating getting stuck, making mistakes, feeling stupid, etc.&lt;/p&gt;

&lt;p&gt;The biggest thing standing if your way from learning how to code is fear. It's all in your head and it's all a lie.&lt;/p&gt;

&lt;p&gt;Learn to turn it off by embracing being a beginner.&lt;/p&gt;

</description>
      <category>career</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Why Writing is Important for Software Developers</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Mon, 09 Aug 2021 13:54:09 +0000</pubDate>
      <link>https://dev.to/howtocode_io/why-writing-is-important-for-software-developers-365l</link>
      <guid>https://dev.to/howtocode_io/why-writing-is-important-for-software-developers-365l</guid>
      <description>&lt;h2&gt;
  
  
  Writing is thinking out loud.
&lt;/h2&gt;

&lt;p&gt;If you want to become a great software developer than you need to be a great writer. I am quite surprised to find so few people talking about how important your writing skills are within the world of software development. Being able to clearly articulate your thoughts is practically a superpower, because most people struggle to do it well.&lt;/p&gt;

&lt;p&gt;Just think about how much writing you need to do as a software developer, that does not involve writing code. Emails, Slack, documentation, readme's, code comments, git commit messages, pull requests, code reviews, etc. I think it would be fair to say that most developers write more words than code every day, and yet I never hear of a developer talking about how they need to improve as a writer. Being able to write great code is incredibly important, please don't misunderstand me, however, being a great writer is even more so. &lt;/p&gt;

&lt;h2&gt;
  
  
  Great writers are great thinkers.
&lt;/h2&gt;

&lt;p&gt;I mentioned earlier that writing is thinking out loud. When you are reading someone else's words, you are reading their thoughts after them. Those words are the result of their thinking. The same can be said about code. When you are doing a code review, or checking out the source code of some open source project, you are reading someone else's thoughts after them. &lt;/p&gt;

&lt;p&gt;This is why when you read great writing you are actually reading great thinking. When you see well written, concise, simple and easy to reason about code, you are reading great thinking. The common denominator is great thinking in both cases. &lt;/p&gt;

&lt;p&gt;So how do you become a better thinker? By becoming a better writer. How do you become a better writer? By becoming a better reader and by writing a lot.&lt;/p&gt;

&lt;h2&gt;
  
  
  There are no shortcuts
&lt;/h2&gt;

&lt;p&gt;I am sure you have heard something along the lines of, "a great developer is a lazy developer." This is true and the sentiment often refers to the fact that great developers automate as much as possible. We possess the power to wield computers however we wish, and when we use this power to delegate much of our work, we are considered "lazy" which is an admirable trait.&lt;/p&gt;

&lt;p&gt;The trait of being a "lazy" developer does not hold water however when it comes to being a great writer. Great writers are anything but lazy. Great writers show up, each and every day, and write -- and they write a lot! There simply are no shortcuts to becoming better at writing. The more and more you write the better you will become at it, but you have to put in the work.&lt;/p&gt;

&lt;p&gt;There are no shortcuts.&lt;/p&gt;

&lt;p&gt;The beautiful thing about this, is that by recognizing this you already have a leg up on the competition, if you are willing to put in the work. Most people are not willing to put in the work required to become a great writer, and this gives you a significant advantage. &lt;/p&gt;

&lt;h2&gt;
  
  
  Natural talent only gets you so far
&lt;/h2&gt;

&lt;p&gt;I am sure many of you reading this now are thinking, "but I am not a great writer." Very few of us are born great writers, we become great writers by the act of writing... a lot!&lt;/p&gt;

&lt;p&gt;I was quite fortunate to study at a very prestigious music school in college and was surrounded by what felt like thousands of modern day Mozart's. I was the underdog. I couldn't read music, I never had a private music lesson in my life before attending school, and here I was surrounded by kids with perfect pitch, who traveled the world playing with some of the best symphonies on the planet, had record deals, you name it. On the surface it seemed like I didn't belong, and maybe that was true, at least at first. However, what I brought to the table and what made me stand out from all of them was my work ethic. &lt;/p&gt;

&lt;p&gt;You see, many of them were quite arrogant and relied solely upon their natural God given talent. I was not gifted with as much talent as most of them, but I worked harder than all of them. Eventually, I surpassed them, because of my hard work ethic. Developing a hard work ethic was one of the greatest lessons I learned while studying there as it has catapulted my career ever since. &lt;/p&gt;

&lt;p&gt;The same is true for you and your writing. Not everyone is born a Hemingway, and even he had to write a lot to develop his tremendous talent. &lt;/p&gt;

&lt;p&gt;Most people are not born great, they become great. &lt;/p&gt;

&lt;p&gt;You simply need to write more than the competition and eventually you will surpass them. There is a limit to how far natural talent will get you, but there is not limit to how far you can get with a strong work ethic. So work hard at your writing and hone those skills on a regular basis, every day if possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Establish a daily writing habit
&lt;/h2&gt;

&lt;p&gt;Establishing habits becomes increasingly more difficult the older you become, so start to establish a daily writing habit as early as possible. You don't have to write 5,000 words a day, you simply need to exercise your writing muscles. If you only have 10 minutes, than work with what you have. Writing for 10 minutes a day is more effective than not writing at all. &lt;/p&gt;

&lt;h2&gt;
  
  
  Writing to throw it all away
&lt;/h2&gt;

&lt;p&gt;Often times people get stuck staring at the blank page because they cannot think about anything to write about. They think they have to write something perfect, well edited, well informed, with a sophisticated vocabulary. That may be true if you are writing for a large publication or trying to write a NY times best seller, but you are doing none of those things. You are writing emails, Slack messages, documentation, etc. &lt;/p&gt;

&lt;p&gt;When you sit down to write every day, just write, knowing that you can simply throw it all away. What is most important is showing up and practicing your writing each and every day. If you really have no ideas, write about how you have no ideas, and how you are feeling about that. Write about what you would like to accomplish that day, or what you are grateful for, etc. Just write!&lt;/p&gt;

&lt;h2&gt;
  
  
  Practice in Public
&lt;/h2&gt;

&lt;p&gt;Finally, the last thing I would like to mention is the importance of practicing your writing in public. If you don't have a blog, start one. If you don't want to write a blog, post on Twitter or your social media platform of choice on a regular basis. Here is the thing, if you are just starting out, no one is going to read what you write anyways, so what are you so concerned about? Just start writing. &lt;/p&gt;

&lt;p&gt;Over time your writing will improve and you will start to gain some attention and begin to build a small audience. As your audience grows, so will your writing skills. The both grow naturally and organically together, so stop worrying and just start writing and publishing as often as possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap Up
&lt;/h2&gt;

&lt;p&gt;Writing is incredibly important as a software developer and will serve you well for the rest of your career and your life. Establish a daily writing habit starting today. The benefits will far exceed anything you can imagine.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Jamstack ecommerce site with Gatsby &amp; Stripe Checkout</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Wed, 06 Jan 2021 13:24:58 +0000</pubDate>
      <link>https://dev.to/howtocode_io/how-to-build-a-jamstack-ecommerce-site-with-gatsby-stripe-checkout-57k6</link>
      <guid>https://dev.to/howtocode_io/how-to-build-a-jamstack-ecommerce-site-with-gatsby-stripe-checkout-57k6</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/LhhxQGdm3uo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;This project builds on top of the &lt;a href="https://www.gatsbyjs.com/tutorial/ecommerce-tutorial"&gt;Gatsby E-commerce Tutorial&lt;/a&gt; provided in the official Gatsby docs, and the &lt;a href="https://github.com/dayhaysoos/use-shopping-cart/tree/master/examples/gatsby"&gt;Use Shopping Cart Example repo&lt;/a&gt;.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this project, we will be creating a simple e-commerce web site with Gatbsy and Stripe checkout. Stripe checkout is client-side checkout that allows us to integrate a complete checkout experience without a backend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Gatsby
&lt;/h2&gt;

&lt;p&gt;First, you will need to download and install &lt;a href="https://www.gatsbyjs.com"&gt;Gatsby&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; gatsby-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the CLI installed, create a new project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gatsby new stripe-checkout
&lt;span class="c"&gt;# name the project whatever you would like&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open up the project and run the development server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gatsby develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the server is up and running, you should be able to preview the site at &lt;code&gt;http://localhost:8000/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NTv6ouuY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/gatsby_default_starter.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NTv6ouuY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/gatsby_default_starter.png" alt="Gatsby Default Starter"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing &amp;amp; Configuring Stripe
&lt;/h2&gt;

&lt;p&gt;You will need to create a &lt;a href="https://stripe.com/"&gt;Stripe&lt;/a&gt; account if you don't already have one. You can sign up for a free account to provide all that we need for our project.&lt;/p&gt;

&lt;p&gt;Once you have your Stripe account set up, head back over to your terminal to install the Stripe NPM packages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @stripe/stripe-js gatsby-source-stripe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With both of these packages installed, we now need to add the &lt;code&gt;gatsby-source-stripe&lt;/code&gt; plugin to our &lt;code&gt;gatsby-config.js&lt;/code&gt; file. Add the following to the config.&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;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`gatsby-source-stripe`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;objects&lt;/span&gt;&lt;span class="p"&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;Price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="nx"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secret key goes here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;downloadFiles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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;p&gt;You will notice a key called &lt;code&gt;secretKey&lt;/code&gt; that we need to populate with Stripe's secret key. We will configure this next.&lt;/p&gt;

&lt;p&gt;The entire file should look like this.&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;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;siteMetadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Gatsby Default Starter`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Gatsby Default Starter`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`@gatsbyjs`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;`gatsby-plugin-react-helmet`&lt;/span&gt;&lt;span class="p"&gt;,&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="s2"&gt;`gatsby-source-filesystem`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`images`&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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/src/images`&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="s2"&gt;`gatsby-transformer-sharp`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;`gatsby-plugin-sharp`&lt;/span&gt;&lt;span class="p"&gt;,&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="s2"&gt;`gatsby-plugin-manifest`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`gatsby-starter-default`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;short_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`starter`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;start_url&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;span class="na"&gt;background_color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`#663399`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;theme_color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`#663399`&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;`minimal-ui`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`src/images/gatsby-icon.png`&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="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`gatsby-source-stripe`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Price&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="na"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secret key goes here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;downloadFiles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head back over to the Stripe dashboard and click on "Developers" and then "API keys" on the left-hand side.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T7p7W_2F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_developer_api_keys_sidebar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T7p7W_2F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_developer_api_keys_sidebar.png" alt="Stripe developer API keys sidebar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;make sure to toggle on the "Viewing test data" as well.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the "Standard keys" section, you should see the following.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pD1AaaWt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_standard_keys.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pD1AaaWt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_standard_keys.png" alt="Stripe Standard Keys"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the "Reveal live key" to show your secret key and then copy it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating .env variables
&lt;/h3&gt;

&lt;p&gt;We do not want to paste our secret key into our gatsby config because it would expose it to the outside world. This is a huge security risk! To protect our keys, we will create a &lt;code&gt;.env&lt;/code&gt; file, which allows us to use our keys without exposing them to the public.&lt;/p&gt;

&lt;p&gt;In the root of our gatsby project, create two files called &lt;code&gt;.env.development&lt;/code&gt; &amp;amp; &lt;code&gt;.env.production&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; .env.development
&lt;span class="nb"&gt;touch&lt;/span&gt; .env.production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Within both files, add both your &lt;code&gt;Publishable&lt;/code&gt; and &lt;code&gt;Secret&lt;/code&gt; keys like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;GATSBY_STRIPE_SECRET_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;sk_test_FOlN...
&lt;span class="nv"&gt;GATSBY_STRIPE_PUBLISHABLE_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;pk_test_ibqK...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;GATSBY&lt;/code&gt; prefix is important because we need these variables exposed to the client. You can read more about this &lt;a href="https://www.gatsbyjs.com/docs/how-to/local-development/environment-variables/#example-of-using-an-environment-variable"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.env.production&lt;/code&gt; will contain the keys we need for production; for the sake of this example, our keys will be the same, but in a real-world project, they would be different.&lt;/p&gt;

&lt;p&gt;Now let's add this file to &lt;code&gt;.gitignore&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# dotenv environment variable files&lt;/span&gt;
.env&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;This may already exist from when we first created our project, but double-check just in case.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now we need to use these env variables in our Gatsby config.&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;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`gatsby-source-stripe`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Price&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="nx"&gt;secretKey&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;GATSBY_STRIPE_SECRET_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;downloadFiles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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;p&gt;We also need to include our &lt;code&gt;.env.development&lt;/code&gt; file in our config to have access to the variables. Add the following snippet to the top of the &lt;code&gt;gatsby-config.js&lt;/code&gt; file just above the &lt;code&gt;module.exports = {&lt;/code&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="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dotenv&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;config&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="s2"&gt;`.env.&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="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Stripe Checkout
&lt;/h3&gt;

&lt;p&gt;Now let's set up and configure Stripe checkout. Head over to &lt;code&gt;https://dashboard.stripe.com/settings/checkout&lt;/code&gt;. Under the&lt;br&gt;
"Next steps" section, click the "Enable client-only integration" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--276qrUnU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_enable_client_only_integration.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--276qrUnU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_enable_client_only_integration.png" alt="Stripe enable clienttt only integration"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click "Allow" on the modal that pops up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CPcyr9TI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_allow_modal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CPcyr9TI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_allow_modal.png" alt="Stripe allow modal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should now see some additional fields in the "Next steps" section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rcpyYvOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_client_only_fields.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rcpyYvOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_client_only_fields.png" alt="Stripe client-only fields"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to create some products in Stripe to sell on our site. Click on the "Create your first product" link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--av2L7g5O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_create_your_first_product_link.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--av2L7g5O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_create_your_first_product_link.png" alt="Stripe create your first product link"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the next screen, click on the "Add Product" button to add our first product.&lt;/p&gt;

&lt;p&gt;For this example store, we are going to be selling t-shirts for developers. So let's find some images of dev t-shirt's that we can sell. You are free to use whatever images or products you would like. I am going to use some photos I found from &lt;a href="https://www.redbubble.com/shop/dev+t-shirts"&gt;Redbubble&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter a name for the product, upload the image, set the price, and check the "one-time" button.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Make sure to add a few products so that we have some actual products to populate our store page with.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P4rMTo_x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_product_information.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4rMTo_x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_product_information.png" alt="Stripe product information"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Adding Stripe as a utility function
&lt;/h2&gt;

&lt;p&gt;Per Gatsby's &lt;a href="https://www.gatsbyjs.com/tutorial/ecommerce-tutorial/#extract-loading-of-stripejs-into-a-utility-function"&gt;docs&lt;/a&gt;, they recommend that we wrap &lt;code&gt;Stripe.js&lt;/code&gt; into a utility function so that we can use it across multiple pages.&lt;/p&gt;

&lt;p&gt;Create a new file in &lt;code&gt;src/utils/stripejs.js&lt;/code&gt; and add the following.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;you will need to create the &lt;code&gt;utils&lt;/code&gt; folder as well&lt;/strong&gt;&lt;/em&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;loadStripe&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@stripe/stripe-js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stripePromise&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getStripe&lt;/span&gt; &lt;span class="o"&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="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;stripePromise&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;stripePromise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;loadStripe&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;GATSBY_STRIPE_PUBLISHABLE_KEY&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="nx"&gt;stripePromise&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;getStripe&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding a shopping cart
&lt;/h2&gt;

&lt;p&gt;We will be installing a shopping cart package that will allow our customers to add t-shirts to their cart, as this does not come out of the box with Stripe checkout. Otherwise, customers will only be able to buy a single product at a time.&lt;/p&gt;

&lt;p&gt;We will be installing &lt;a href="https://useshoppingcart.com/getting-started#installation"&gt;Use-Shopping-Cart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install the shopping cart with the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--S&lt;/span&gt; use-shopping-cart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Displaying our products
&lt;/h2&gt;

&lt;p&gt;Now that we have some products uploaded to Stripe, and your shopping cart installed, we need to display them on our Gatsby site.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;The following code comes from the &lt;a href="https://github.com/dayhaysoos/use-shopping-cart/tree/master/examples/gatsby"&gt;Use Shopping Cart Example Gatsby Repo&lt;/a&gt; with only slight modifications made by me&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Index Page
&lt;/h3&gt;

&lt;p&gt;Withing &lt;code&gt;/pages/index.js&lt;/code&gt;, add the following.&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;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Layout&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../components/layout&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;SEO&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../components/seo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Skus&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../components/Products/Skus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;CartOverview&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../components/CartOverview&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;loadStripe&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@stripe/stripe-js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;CartProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use-shopping-cart&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;stripePromise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;loadStripe&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;GATSBY_STRIPE_PUBLISHABLE_KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CartExample&lt;/span&gt; &lt;span class="o"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Layout&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SEO&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Cart Example&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Checkout&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="nx"&gt;example&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;With&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&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;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://use-shopping-cart.netlify.app/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;shopping&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;CartProvider&lt;/span&gt;
      &lt;span class="nx"&gt;mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;client-only&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;stripe&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;stripePromise&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;successUrl&lt;/span&gt;&lt;span class="o"&gt;=&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;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/page-2/`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;cancelUrl&lt;/span&gt;&lt;span class="o"&gt;=&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;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;origin&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;span class="nx"&gt;currency&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;USD&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;allowedCountries&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;US&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GB&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CA&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;
      &lt;span class="nx"&gt;billingAddressCollection&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;CartOverview&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Skus&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/CartProvider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Layout&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;CartExample&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Index Page Breakdown
&lt;/h4&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;CartProvider&lt;/span&gt; &lt;span class="c1"&gt;// This component comes from the use-shopping-cart package&lt;/span&gt;
  &lt;span class="nx"&gt;mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;client-only&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// allows client-side checkout&lt;/span&gt;
  &lt;span class="nx"&gt;stripe&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;stripePromise&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// Our Stripe instance so we can communicate with the Stripe API&lt;/span&gt;
  &lt;span class="nx"&gt;successUrl&lt;/span&gt;&lt;span class="o"&gt;=&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;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/page-2/`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// the url to redirect to after a successful purchase&lt;/span&gt;
  &lt;span class="nx"&gt;cancelUrl&lt;/span&gt;&lt;span class="o"&gt;=&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;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;origin&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;span class="c1"&gt;// the url to redirect to when they cancel a purchase&lt;/span&gt;
  &lt;span class="nx"&gt;currency&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;USD&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// US Dollars is the type of currency we are accepting&lt;/span&gt;
  &lt;span class="nx"&gt;allowedCountries&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;US&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GB&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CA&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;
  &lt;span class="nx"&gt;billingAddressCollection&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// allows the collection of the users billing address for Stripe&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;CartOverview&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// We will create and go over this component later&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Skus&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// We will create and go over this component next&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/CartProvider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Skus Component
&lt;/h3&gt;

&lt;p&gt;Create a new folder called &lt;code&gt;Products&lt;/code&gt; inside the &lt;code&gt;src/components folder&lt;/code&gt; and create a file called &lt;code&gt;Skus.js&lt;/code&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="c1"&gt;// src/components/Products/Skus.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&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;StaticQuery&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gatsby&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;SkuCard&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./SkuCard&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;conatinerStyles&lt;/span&gt; &lt;span class="o"&gt;=&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;flex&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;flexDirection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;row&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;flexWrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wrap&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;justifyContent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;space-between&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem 0 1rem 0&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;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;StaticQuery&lt;/span&gt;
    &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;`
      query ProductPrices {
        prices: allStripePrice(
          filter: { active: { eq: true }, currency: { eq: "usd" } }
          sort: { fields: [unit_amount] }
        ) {
          edges {
            node {
              id
              active
              currency
              unit_amount
              product {
                id
                name
                images
              }
            }
          }
        }
      }
    `&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{({&lt;/span&gt; &lt;span class="nx"&gt;prices&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&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="nx"&gt;conatinerStyles&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;prices&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="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="na"&gt;node&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&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="nx"&gt;newSku&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;product&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="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unit_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;images&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SkuCard&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;sku&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;newSku&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;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="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;)}&lt;/span&gt;
  &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Skus Component Brekdown
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="nx"&gt;ProductPrices&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;allStripePrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;active&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;eq&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;eq&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;usd&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="nl"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;unit_amount&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="nx"&gt;edges&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;id&lt;/span&gt;
        &lt;span class="nx"&gt;active&lt;/span&gt;
        &lt;span class="nx"&gt;currency&lt;/span&gt;
        &lt;span class="nx"&gt;unit_amount&lt;/span&gt;
        &lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;id&lt;/span&gt;
          &lt;span class="nx"&gt;name&lt;/span&gt;
          &lt;span class="nx"&gt;images&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is our GraphQL query which fetches the product data from Stripe. We are filtering for only active products where the currency is &lt;code&gt;==&lt;/code&gt; US Dollars. We then retrieve the id, whether or not the product is active, the currency, unit_amount, product id, product name, and product images.&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;render&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{({&lt;/span&gt; &lt;span class="nx"&gt;prices&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&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="nx"&gt;conatinerStyles&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;prices&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="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="na"&gt;node&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&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="nx"&gt;newSku&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;product&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="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unit_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;images&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SkuCard&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;sku&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;newSku&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;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="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We then take the results of our GraphQL query and &lt;code&gt;map&lt;/code&gt; over the products returned and create a &lt;code&gt;newSku&lt;/code&gt; object for each product. We then take the &lt;code&gt;newSku&lt;/code&gt; object and pass it into the &lt;code&gt;&amp;lt;SkuCard /&amp;gt;&lt;/code&gt; component via the &lt;code&gt;sku&lt;/code&gt; prop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sku Card Component
&lt;/h3&gt;

&lt;p&gt;Create a new file called &lt;code&gt;SkuCard.js&lt;/code&gt; in the &lt;code&gt;src/components/Products&lt;/code&gt; folder.&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="c1"&gt;// src/components/Products/SkuCard.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useShoppingCart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;formatCurrencyString&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use-shopping-cart&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cardStyles&lt;/span&gt; &lt;span class="o"&gt;=&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;flex&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;flexDirection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;column&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;justifyContent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;space-around&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;alignItems&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;flex-start&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem&lt;/span&gt;&lt;span class="dl"&gt;'&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;boxShadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;5px 5px 25px 0 rgba(46,61,73,.2)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#fff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;borderRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;6px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;maxWidth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;300px&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonStyles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;fontSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;13px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;textAlign&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#fff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;12px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;boxShadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2px 5px 10px rgba(0,0,0,.1)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rgb(255, 178, 56)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;borderRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;6px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;letterSpacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1.5px&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SkuCard&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;sku&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;addItem&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useShoppingCart&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&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="nx"&gt;cardStyles&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h4&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;sku&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h4&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="na"&gt;Price&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &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="nx"&gt;formatCurrencyString&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
          &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
          &lt;span class="na"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currency&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="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&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="nx"&gt;buttonStyles&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&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="nx"&gt;addItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;ADD&lt;/span&gt; &lt;span class="nx"&gt;TO&lt;/span&gt; &lt;span class="nx"&gt;CART&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&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="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;SkuCard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Sku Card Component Breakdown
&lt;/h4&gt;

&lt;p&gt;This component is fairly straight forward. We take the data passed into it via the &lt;code&gt;sku&lt;/code&gt; prop and then render the appropriate markup and styling accordingly. This card component will wrap each of our products and display the product image, name, price and the Add to Cart button.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shopping Cart Component
&lt;/h3&gt;

&lt;p&gt;Lastly, we will create a component for our shopping cart.&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="c1"&gt;// src/components/CartOverview.js&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useShoppingCart&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use-shopping-cart&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonStyles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;fontSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;13px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;textAlign&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#fff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;12px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;boxShadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2px 5px 10px rgba(0,0,0,.1)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rgb(255, 178, 56)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;borderRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;6px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;letterSpacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1.5px&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Cart&lt;/span&gt; &lt;span class="o"&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="cm"&gt;/* Gets the totalPrice and a method for redirecting to stripe */&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;formattedTotalPrice&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;redirectToCheckout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;cartCount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;clearCart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useShoppingCart&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&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;/* This is where we'll render our cart */&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;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="na"&gt;Items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;cartCount&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;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;Total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;formattedTotalPrice&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;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Redirects the user to Stripe */&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;button&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="nx"&gt;buttonStyles&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;disabled&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&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;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="nx"&gt;redirectToCheckout&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;loading&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Loading...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Checkout&lt;/span&gt;&lt;span class="dl"&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="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&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="nx"&gt;buttonStyles&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;clearCart&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Clear&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&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="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Cart&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Shopping Cart Component Breakdown
&lt;/h4&gt;

&lt;p&gt;Our shopping cart displays the total number of products in our cart and the total price of all of those items and two buttons. One button redirects to the checkout, which is Stripe checkout in our case, and the other empties the cart.&lt;/p&gt;

&lt;p&gt;Our site should now look like this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finished Store
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jCm7Rns6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/gatsby_store_home_page.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jCm7Rns6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/gatsby_store_home_page.png" alt="Gatsby store home page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add a couple of products to the cart and then click "Checkout."&lt;/p&gt;

&lt;p&gt;If everything goes well, you will see Stripe checkout.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fp_zQ30L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_checkout_page.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fp_zQ30L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_checkout_page.png" alt="Stripe checkout page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill out the details and use the special Stripe credit card &lt;code&gt;4242 4242 4242 4242&lt;/code&gt;. For the expiration date, choose any date in the future and use any three-digit number for the security code.&lt;/p&gt;

&lt;p&gt;Now, if you open up your Stripe dashboard and click on "Payments" in the left sidebar, you should see the purchase you just made.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;remember to make sure the "Viewing test data" is toggled on in the left sidebar&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4Z4-CkAS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_successful_purchase.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Z4-CkAS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/stripe_successful_purchase.png" alt="Stripe successful purchase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying to Vercel
&lt;/h2&gt;

&lt;p&gt;We will deploy our site to &lt;a href="https://vercel.com/dashboard"&gt;Vercel&lt;/a&gt;, another popular hosting provider for Jamstack sites. Head over there and sign up for a free account.&lt;/p&gt;

&lt;p&gt;Before we can use Vercel, we first need to push our Gatsby site up to GitHub.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;If you forget how to do this, please take a look back at the Hugo Blog project where I show you how to set this up.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After logging in, you should see Vercel's dashboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SbWVDUnD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_dashboard.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SbWVDUnD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_dashboard.png" alt="Vercel Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on "Import project" and then "Import Git Repository."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Uk6UCFCD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_import_repo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Uk6UCFCD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_import_repo.png" alt="Vercel import repo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You then need to paste in the URL of your repo from GitHub and press "Continue."&lt;/p&gt;

&lt;p&gt;Vercel is smart enough to detect that this is a Gatsby project, and so the "Build and Output Settings" are already configured for us. However, we need to paste in our &lt;code&gt;.env&lt;/code&gt; variables in the "Environment Variables" section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1M4FP59g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_environment_variables.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1M4FP59g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_environment_variables.png" alt="Vercel Environment Variables"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then press the "Deploy" button.&lt;/p&gt;

&lt;p&gt;After a couple of mins or so, you should see the following.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WN6-itOw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_successful_deploy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WN6-itOw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://howtocode.io/assets/gatsby-ecommerce/vercel_successful_deploy.png" alt="Vercel Successful Deploy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the "Visit" button to see the live site.&lt;/p&gt;

&lt;p&gt;Make a test purchase to ensure that Stripe checkout is working correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Repo
&lt;/h2&gt;

&lt;p&gt;The completed project can be found here inside of &lt;code&gt;Gatsby-eCommerce/final&lt;/code&gt; &lt;br&gt;
&lt;a href="https://github.com/robertguss/howtocode-understanding-the-jamstack"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap Up
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we learned how to create an ecommerce site using Gatsby and Stripe Checkout. We also installed a shopping cart plugin and deployed our site to Vercel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Jamstack Book
&lt;/h2&gt;

&lt;p&gt;My book Understanding the Jamstack is "pay what you want." You can get it for free by entering &lt;code&gt;0&lt;/code&gt; for the price at checkout.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gum.co/understanding-the-jamstack"&gt;Buy Understanding the Jamstack&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Jamstack membership site with Eleventy &amp; Memberstack</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Wed, 06 Jan 2021 13:23:23 +0000</pubDate>
      <link>https://dev.to/howtocode_io/how-to-build-a-jamstack-membership-site-with-eleventy-memberstack-23p4</link>
      <guid>https://dev.to/howtocode_io/how-to-build-a-jamstack-membership-site-with-eleventy-memberstack-23p4</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/8MpPmSWXBX4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;For this project, we are going to be building a membership site using the &lt;a href="https://www.11ty.dev/" rel="noopener noreferrer"&gt;Eleventy&lt;/a&gt; static site generator and &lt;a href="https://www.memberstack.com/" rel="noopener noreferrer"&gt;Memberstack&lt;/a&gt;. We will then deploy our membership site with &lt;a href="https://surge.sh/" rel="noopener noreferrer"&gt;Surge&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Eleventy
&lt;/h2&gt;

&lt;p&gt;First, you will need to download the &lt;a href="https://github.com/robertguss/howtocode-understanding-the-jamstack" rel="noopener noreferrer"&gt;course repo&lt;/a&gt; and use the &lt;code&gt;start/&lt;/code&gt; folder located within &lt;code&gt;Eleventy-Membership.&lt;/code&gt; This repo contains the theme for our site, which will allow us to hit the ground running. Memberstack provided the theme as just a &lt;code&gt;.zip&lt;/code&gt; of HTML, CSS, and js files. I then took all of those files and integrated them with Eleventy to make our lives easier and so that you can become familiar with another static site generator.&lt;/p&gt;

&lt;p&gt;Open your terminal inside of the &lt;code&gt;start/&lt;/code&gt; folder and install the npm packages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then start the eleventy server to serve up our site.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The terminal should display various URLs to access the site.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_server_urls.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_server_urls.png" alt="Eleventy Server urls"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I like to use &lt;code&gt;http://localhost:8080/&lt;/code&gt;, which is the "Local" URL.&lt;/p&gt;

&lt;p&gt;When you open the URL in your browser, you should see a site that looks like this.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_homepage.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_homepage.png" alt="Eleventy Homepage"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is a relatively simple site with some placeholder content and two pricing tables at the very bottom. Take a couple of mins to click around on the navigation links to see what the pages look like. There is a login form, a signup form, and two membership areas.&lt;/p&gt;

&lt;p&gt;We will be using Memberstack for handling our user login, authentication, sessions, and payments. Memberstack will handle all of the backend, whereas we just have to provide the front-end content for our members.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrating Memberstack
&lt;/h2&gt;

&lt;p&gt;Before we can begin using &lt;a href="https://www.memberstack.com/" rel="noopener noreferrer"&gt;Memberstack&lt;/a&gt;, you need to sign up for a free account. Once you have signed up and log in, you will see the following screen.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_select_a_builder.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_select_a_builder.png" alt="Memberstack Select a Builder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose "HTML/CSS"&lt;/p&gt;

&lt;p&gt;On the next screen, give your site a name. I called my "Eleventy Membership," but you can name it whatever you would like. Also, make sure to select the need to accept payments as we will be integrating with Stripe later. Then click the "Let's go!" button.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_website_details.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_website_details.png" alt="Memberstack Website Details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will land on your membership dashboard for our site.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_dashboard.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_dashboard.png" alt="Memberstack Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Memberstack gives us a checklist we need to follow to set up our new site. Click on the "Create a membership" button on the Setup Checklist.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_create_a_membership.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_create_a_membership.png" alt="Memberstack Create a membership"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the next screen, click on the "New Membership" button. Here is where we will set up our two memberships, "basic" &amp;amp; "premium". Let's start with the basic plan first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic Membership
&lt;/h3&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_plan_settings.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_plan_settings.png" alt="Memberstack Basic Plan Settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter "Basic Plan" for the plan name.&lt;/li&gt;
&lt;li&gt;Select the "Require Payment" button.&lt;/li&gt;
&lt;li&gt;Enter $49 for the price. This is the price listed on the pricing tables of our site.&lt;/li&gt;
&lt;li&gt;Select "Monthly" for the billing frequency&lt;/li&gt;
&lt;li&gt;Free Trial, Setup Fee &amp;amp; Collect taxes can remain off for now.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now click on the "Hide Content" button in the "Members-only content" section. This section will make sure that users who do not have access to either membership plan cannot access the content.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter "Basic Plan" for the content name.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;basic&lt;/code&gt; for the "Hide pages &amp;amp; folders" field. This will hide all of the basic plan content from users who do not have a basic plan.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;login&lt;/code&gt; for the "Access denied page." This will redirect users who try to access the basic account page who are not logged in or are not paying subscribers.&lt;/li&gt;
&lt;li&gt;Click the "Create" button at the bottom.&lt;/li&gt;
&lt;/ol&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_page_hide_content.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_page_hide_content.png" alt="Memberstack Basic Page Hide Content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the "Page after signup" &amp;amp; "Page after login" enter &lt;code&gt;basic/account/&lt;/code&gt;&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_page_after_signup.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_page_after_signup.png" alt="Memberstack Basic Page After Signup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Memberstack will redirect any user who has a "basic plan" membership to the basic account page after signing up and each time they log in.&lt;/p&gt;

&lt;p&gt;Then click the "Create Membership" button.&lt;/p&gt;

&lt;p&gt;Your Membership dashboard should now look like this.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_plan_dashboard.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_plan_dashboard.png" alt="Memberstack Basic Plan Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Premium Membership
&lt;/h3&gt;

&lt;p&gt;Click on the "New Membership" button.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_plan_settings.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_plan_settings.png" alt="Memberstack Premium Plan Settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter "Premium Plan" for the plan name.&lt;/li&gt;
&lt;li&gt;Select the "Require Payment" button.&lt;/li&gt;
&lt;li&gt;Enter $499 for the price. This is the price listed on the pricing tables of our site.&lt;/li&gt;
&lt;li&gt;Select "Yearly" for the billing frequency&lt;/li&gt;
&lt;li&gt;Free Trial, Setup Fee &amp;amp; Collect taxes can remain off for now.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now click on the "Hide Content" button in the "Members-only content" section. This section will make sure that users who do not have access to either membership plan cannot access the content.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter "Premium Plan" for the content name.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;premium&lt;/code&gt; for the "Hide pages &amp;amp; folders" field. This will hide all of the premium plan content from users who do not have a premium plan.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;login&lt;/code&gt; for the "Access denied page." This will redirect users who try to access the premium account page who are not logged in or are not paying subscribers.&lt;/li&gt;
&lt;li&gt;Click the "Create" button at the bottom.&lt;/li&gt;
&lt;/ol&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_page_hide_content.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_page_hide_content.png" alt="Memberstack Premium Page Hide Content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure that both the "Basic Plan" &amp;amp; "Premium Plan" are on. Our premium members get access to both basic and premium content.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_and_basic_content.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_and_basic_content.png" alt="Basic and Premium Plan Content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the "Page after signup" &amp;amp; "Page after login" enter &lt;code&gt;premium/account/&lt;/code&gt;&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_page_after_signup.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_page_after_signup.png" alt="Memberstack Premium Page After Signup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Memberstack will redirect the users who have a "premium plan" membership to the premium account page after signing up and after logging in.&lt;/p&gt;

&lt;p&gt;Then click the "Create Membership" button.&lt;/p&gt;

&lt;p&gt;Your Membership dashboard should now look like this.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_plan_dashboard.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_plan_dashboard.png" alt="Memberstack Premium Plan Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Integrating Memberstack Memberships
&lt;/h3&gt;

&lt;p&gt;Now that we have both of our memberships configured, we need to integrate them on our site so that our users can signup for them.&lt;/p&gt;

&lt;p&gt;Underneath the "Membership Plans" section of our dashboard are both membership plans. To the right of those are buttons called "Signup link" this is the code snippet we need to link our memberships on our site to Memberstack. Click on the "Signup link" for the Basic plan first.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_signup_link.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_basic_signup_link.png" alt="Memberstack Basic Signup Link"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click the "I'd rather use data attributes" and copy the attribute.&lt;/p&gt;

&lt;p&gt;Then head back over to our site's code and open the &lt;code&gt;index.html&lt;/code&gt; file and scroll to around line &lt;code&gt;232&lt;/code&gt; and add the the data attribute to our basic signup link like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt;
  &lt;span class="na"&gt;data-ms-membership=&lt;/span&gt;&lt;span class="s"&gt;"5fd8ca13..."&lt;/span&gt;
  &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"signup"&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button full-button w-inline-block"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Get Started&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's do the same for our premium membership. Head back to Memberstack and copy the data attribute for the premium plan.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_signup_link.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_premium_signup_link.png" alt="Memberstack Premium Signup Link"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add the data attribute to our premium link around line &lt;code&gt;247&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt;
  &lt;span class="na"&gt;data-ms-membership=&lt;/span&gt;&lt;span class="s"&gt;"5fd8cfb1..."&lt;/span&gt;
  &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"signup"&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button full-button secondary-button w-inline-block"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Get Started&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Installing Memberstack Header code
&lt;/h3&gt;

&lt;p&gt;Next, we need to install the Memberstack &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of our site. Head back over to the main dashboard of Memberstack and click on the "Install header code" underneath the Setup Checklist.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_install_header_code.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_install_header_code.png" alt="Memberstack Install Header Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the code snippet in there and then paste the snippet just above the closing &lt;code&gt;&amp;lt;/head&amp;gt;&lt;/code&gt; tag in &lt;code&gt;src/_includes/layouts/base.html.&lt;/code&gt; The file should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Additional Code Above --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
  &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/asssets/images/Freebie-Favicon.png"&lt;/span&gt;
  &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"shortcut icon"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"image/x-icon"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
    &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://howtocode.io/assets/images/Freebie-Webclip.png"&lt;/span&gt;
    &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"apple-touch-icon"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="c"&gt;&amp;lt;!-- Memberstack --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;script
    &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://api.memberstack.io/static/memberstack.js?custom"&lt;/span&gt;
    &lt;span class="na"&gt;data-memberstack-id=&lt;/span&gt;&lt;span class="s"&gt;"751ee1..."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note: the formatting &amp;amp; indentation might be different in your file.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Signup Form
&lt;/h2&gt;

&lt;p&gt;Next, we need to integrate Memberstack without Signup Form. On the Memberstack main dashboard, click on the "Add a Login form" under the "More Features" section.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_add_login_form.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_add_login_form.png" alt="Memberstack Add Login Form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will be taken to the "Login" form section, but we need to set up the "Signup" form first. So click on the "Signup" tab at the top.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_signup_form.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_signup_form.png" alt="Memberstack Signup Formm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, the Signup form comes with fields for &lt;code&gt;email&lt;/code&gt; and &lt;code&gt;password.&lt;/code&gt; Our form also has a field for &lt;code&gt;first name&lt;/code&gt; and &lt;code&gt;last name.&lt;/code&gt;&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_signup_form.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_signup_form.png" alt="Eleventy Signup Form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the "Add custom fields" button to add the First Name Field.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_first_name_field.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_first_name_field.png" alt="Memberstack First Name Field"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add another field for the &lt;code&gt;Last Name.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The signup form should now look like this:&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_signup_form_all_fields.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_signup_form_all_fields.png" alt="Memberstack Signup Form All Fields"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll to the bottom of the form under the "Signup form type" and select &lt;code&gt;Build a custom signup form.&lt;/code&gt;&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_build_a_custom_signup_form.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_build_a_custom_signup_form.png" alt="Memberstack Build a custom signup form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the data attribute.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_signup_form_data_attribute.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_signup_form_data_attribute.png" alt="Memberstack signup form data attribute"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We now need to add this to the signup &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element on our site. Add the data attribute to the &lt;code&gt;form&lt;/code&gt; element in &lt;code&gt;signup.html&lt;/code&gt; around line &lt;code&gt;12&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt;
  &lt;span class="na"&gt;data-ms-form=&lt;/span&gt;&lt;span class="s"&gt;"signup"&lt;/span&gt;
  &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"sign-up"&lt;/span&gt;
  &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"wf-form-Sign-up-Form"&lt;/span&gt;
  &lt;span class="na"&gt;data-name=&lt;/span&gt;&lt;span class="s"&gt;"Sign up Form"&lt;/span&gt;
  &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt;
  &lt;span class="na"&gt;ms-signup=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"login-form"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Login Form
&lt;/h2&gt;

&lt;p&gt;Next, let's set up our login form.&lt;/p&gt;

&lt;p&gt;Click on the "Login" tab at the top of the Memberstack Dashboard.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_login_form.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_login_form.png" alt="Memberstack Login Form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our site's login form only has an email and password field, so the default fields that Memberstack provides are just what we need.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_login_form.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_login_form.png" alt="Eleventy Login Form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the Memberstack dashboard, scroll to the bottom and select "Build a custom login form," just like we did for the signup form.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_login_custom_form.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_login_custom_form.png" alt="Memberstack Custom Login Form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then copy the data attribute and paste it into the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element of the login form around line &lt;code&gt;13&lt;/code&gt; of &lt;code&gt;login.html&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt;
  &lt;span class="na"&gt;data-ms-form=&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt;
  &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt;
  &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"wf-form-login"&lt;/span&gt;
  &lt;span class="na"&gt;data-name=&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt;
  &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt;
  &lt;span class="na"&gt;ms-login=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"login-form"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Deploying to Surge
&lt;/h2&gt;

&lt;p&gt;Now that we have our site set up with Memberstack, we need to deploy it to a live URL for testing. We will be deploying with &lt;a href="https://surge.sh/" rel="noopener noreferrer"&gt;Surge&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, we need to install Surge as a global NPM package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; surge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we need to build our static site.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we can deploy our site with this simple command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;surge dist
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Surge to deploy our &lt;code&gt;dist&lt;/code&gt; folder, which contains our built static site.&lt;/p&gt;

&lt;p&gt;If this is the first time you are using Surge, you will be asked to create an account. After doing so, you should see something similar to this.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fsurge_domain.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fsurge_domain.png" alt="Surge Domain"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press enter, and in a few seconds, your site will be live. Head on over to the domain surge provides and open it in your browser.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fsurge_homepage.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fsurge_homepage.png" alt="Surge Homepage"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the domain that Surge gives you and paste it into the &lt;code&gt;deploy&lt;/code&gt; script within &lt;code&gt;package.json&lt;/code&gt; like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eleventy-memberstack"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx eleventy --serve"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx eleventy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deploy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm run build &amp;amp;&amp;amp; surge dist --domain faulty-hate.surge.sh"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keywords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ISC"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"devDependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"@11ty/eleventy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^0.11.1"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a custom script I wrote that will automatically build our eleventy site and deploy to Surge whenever we run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After you have updated the script with your surge URL, run the &lt;code&gt;deploy&lt;/code&gt; command to ensure everything is working correctly.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fsurge_deploy.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fsurge_deploy.png" alt="Surge deploy command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing Memberstack Integration
&lt;/h2&gt;

&lt;p&gt;Now that our site is live let's test to ensure Memberstack is working correctly.&lt;/p&gt;

&lt;p&gt;First, let's try to access the &lt;code&gt;/basic/account&lt;/code&gt; page, which is reserved only for users who have a basic membership. On your live surge site, go to &lt;code&gt;https://faulty-hate.surge.sh/basic/account,&lt;/code&gt; replacing the domain with whichever one Surge provided you.&lt;/p&gt;

&lt;p&gt;You will be redirected to the &lt;code&gt;login&lt;/code&gt; page.&lt;/p&gt;

&lt;p&gt;Now try to access the premium account by going to &lt;code&gt;/premium/account/.&lt;/code&gt; For example, &lt;code&gt;https://faulty-hate.surge.sh/premium/account/.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You will be redirected to the &lt;code&gt;login&lt;/code&gt; page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic Membership Signup
&lt;/h3&gt;

&lt;p&gt;Now let's try to signup for a basic plan. Scroll to the bottom of the home page to the pricing tables and click on the basic plan. Fill out the signup form and press "Continue." You should be prompted with a modal like this:&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_basic_plan_signup.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_basic_plan_signup.png" alt="Eleventy Basic Plan Purchase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click confirm and pay.&lt;/p&gt;

&lt;p&gt;After a few seconds, you will be redirected to &lt;code&gt;/basic/account,&lt;/code&gt; the basic account membership area. So far, so good! Memberstack handles all of the session and authentication for us, so we are currently logged in as a basic member.&lt;/p&gt;

&lt;p&gt;Now that we are logged in, try to go to &lt;code&gt;/premium/account,&lt;/code&gt; and you should be redirected to the login page.&lt;/p&gt;

&lt;p&gt;So our basic memberships are working, and these members are unable to access the premium section of our site. Awesome!&lt;/p&gt;

&lt;h3&gt;
  
  
  Logging out
&lt;/h3&gt;

&lt;p&gt;Now that we are signed in, we need a way for our users to sign out. We need to add a logout button to the nav of our &lt;code&gt;/basic/account&lt;/code&gt; page right next to the "Change Plan" button.&lt;/p&gt;

&lt;p&gt;Add the following to &lt;code&gt;src/basic/account.html&lt;/code&gt; &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; tag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#/ms/logout"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button navbar-cta w-nav-link"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Log Out&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"navigation"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"homepage-nav-menu w-nav-menu"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#/ms/logout"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button navbar-cta w-nav-link"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Log Out&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/basic/upgrade"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button navbar-cta w-nav-link"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Change Plan&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire &lt;code&gt;account.html&lt;/code&gt; file should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;{% extends "layouts/base.html" %} {% block content %}

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt;
  &lt;span class="na"&gt;data-collapse=&lt;/span&gt;&lt;span class="s"&gt;"medium"&lt;/span&gt;
  &lt;span class="na"&gt;data-animation=&lt;/span&gt;&lt;span class="s"&gt;"default"&lt;/span&gt;
  &lt;span class="na"&gt;data-duration=&lt;/span&gt;&lt;span class="s"&gt;"400"&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"navbar w-nav"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"brand w-nav-brand"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://howtocode.io/assets/images/heart.svg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"navigation"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"homepage-nav-menu w-nav-menu"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#/ms/logout"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button navbar-cta w-nav-link"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Log Out&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/basic/upgrade"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button navbar-cta w-nav-link"&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Change Plan&lt;span class="nt"&gt;&amp;lt;/a&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"menu-button w-nav-button"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"w-icon-nav-menu"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"delete-me-section"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"account-h1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Basic Account&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"w-richtext"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Member&lt;span class="ni"&gt;&amp;amp;#x27;&lt;/span&gt;s only areas can be any combination of the following:&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;an individual page&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;a group of pages&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;folders&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;CMS items&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;or entire CMS collections&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

{% endblock %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that in place, let's push our latest changes to Surge and test.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should still be logged in, so navigate to &lt;code&gt;/basic/account&lt;/code&gt; and you should see our new "Log Out" button at the top. When you click it, you should be redirected to the home page. Try to access &lt;code&gt;/basic/account&lt;/code&gt; again, and you will be redirected to the home page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Premium Membership Signup
&lt;/h3&gt;

&lt;p&gt;Now that we have confirmed our basic membership is working, let's test out the premium membership.&lt;/p&gt;

&lt;p&gt;On the home page, scroll to the pricing tables at the bottom and click on the premium membership. Fill out the form, and you will see the Premium payment form.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_premimum_plan_checkout.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Feleventy_premimum_plan_checkout.png" alt="Eleventy Premium Plan Checkout"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should be redirected to the &lt;code&gt;/premium/account&lt;/code&gt; page. Since premium also included access to everything the basic membership has, you should also be able to access &lt;code&gt;/basic/account.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This page will also need a log out button, but you already know how to do that. If you want one on this page as well, by all means, go for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting Stripe for payments
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;This next section is optional and is only useful if you are launching a live membership site. Currently, there is no way to test payments taken from Memberstack with Stripe while in the demo/test mode. Your membership site must be live for the charges to show up in Stripe.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;All of our testing thus far has been in test mode. If you noticed, when we tried to signup for these plans, we didn't have to enter in any actual credit card information. We can connect Stripe so we can receive real money from real customers.&lt;/p&gt;

&lt;p&gt;First, you will need to set up a &lt;a href="https://stripe.com/" rel="noopener noreferrer"&gt;free Stripe account&lt;/a&gt;. After that, head back over to the Memberstack dashboard.&lt;/p&gt;

&lt;p&gt;In the main Memberstack dashboard, there is a settings section; click on that to expand it and click on "Connect to Stripe."&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_connect_to_stripe.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_connect_to_stripe.png" alt="Memberstack Connect to Stripe"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this screen, click the big button to connect to Stripe, you should see a screen like this.&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fstripe_connnect_to_memberstack.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fstripe_connnect_to_memberstack.png" alt="Stripe connect to Memberstack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the "Connect my Stripe account" button.&lt;/p&gt;

&lt;p&gt;You should then be redirected back to Memberstack and see the following:&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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_stripe_successfully_connected.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%2Fhowtocode.io%2Fassets%2Feleventy-membership%2Fmemberstack_stripe_successfully_connected.png" alt="Memberstrack Stripe Successfully Connected"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Repo
&lt;/h2&gt;

&lt;p&gt;You can find the project repo here inside of &lt;code&gt;Eleventy-Membership/final&lt;/code&gt;&lt;br&gt;
&lt;a href="https://github.com/robertguss/howtocode-understanding-the-jamstack" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;Well, that wraps up this project. To recap, we used Memberstack to create a membership Jamstack site with two membership plans "basic" &amp;amp; "premium." Within Memberstack, we could designate which portion of the site basic and premium members can access and redirect users who do not have the appropriate access. We also learned how to integrate Stripe if we decide to launch a live membership site.&lt;/p&gt;

&lt;p&gt;We also gained some experience with the Eleventy static site generator. This SSG is quite popular and is growing ever more so in popularity. It is quite simple to use and has a lot of features built-in by default. It provides several templating languages and other features that make getting Jamstack sites up and running quickly.&lt;/p&gt;

&lt;p&gt;For hosting and deployment, we used Surge. Surge is a simple NPM package that allows us to publish static sites with just a single command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Jamstack Book
&lt;/h2&gt;

&lt;p&gt;My book Understanding the Jamstack is "pay what you want." You can get it for free by entering &lt;code&gt;0&lt;/code&gt; for the price at checkout.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gum.co/understanding-the-jamstack" rel="noopener noreferrer"&gt;Buy Understanding the Jamstack&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Jamstack blog with Hugo, Netlify CMS and Zapier</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Wed, 06 Jan 2021 13:21:48 +0000</pubDate>
      <link>https://dev.to/howtocode_io/how-to-build-a-jamstack-blog-with-hugo-netlify-cms-and-zapier-14dc</link>
      <guid>https://dev.to/howtocode_io/how-to-build-a-jamstack-blog-with-hugo-netlify-cms-and-zapier-14dc</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/bY-CggQf9B8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;We will be building a blog using the &lt;a href="https://gohugo.io" rel="noopener noreferrer"&gt;Hugo&lt;/a&gt; Static Site Generator and then deploy it to Netlify. Once our blog is complete and lives on Netlify, we will then integrate &lt;a href="https://zapier.com/" rel="noopener noreferrer"&gt;Zapier&lt;/a&gt; to trigger our site's automatic CI/CD pipelines. Zapier will allow us to write blog posts ahead of time by setting a publish date sometime in the future. It will then notify Netlify to build our site so that the entire process is automated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Hugo
&lt;/h2&gt;

&lt;p&gt;Hugo is written in the Go Programming Language, making it very easy to install since it is just a single binary. To install Hugo, head over to their &lt;a href="https://gohugo.io/getting-started/installing" rel="noopener noreferrer"&gt;Installation Docs&lt;/a&gt; and follow along for whatever operating system you are using. I am using Mac and have installed Hugo with &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;Homebrew&lt;/a&gt;. &lt;em&gt;I highly recommend using Homebrew if you are on a Mac.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the blog
&lt;/h2&gt;

&lt;p&gt;Now that you have Hugo installed, run the following command to create a new Hugo site:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Hugo new site blog

&lt;span class="c"&gt;# blog will be the name of the folder and project&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;If you are like me, you probably already have a directory where all of your web/code projects live on your computer. I have a folder called &lt;code&gt;Projects&lt;/code&gt; on my laptop, which contains all of my projects. I recommend you have something similar on your machine and install it there.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We are going to be using a pre-configured theme for Hugo called &lt;a href="https://themes.gohugo.io/hugo-ink/" rel="noopener noreferrer"&gt;Ink&lt;/a&gt;. You can&lt;br&gt;
download the theme from Github &lt;a href="https://github.com/knadh/hugo-ink" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Click on the green button called "Code" and then "Download Zip."&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fink_github_download.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fink_github_download.png" alt="Ink GitHub Download"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you download the zip file and unzip it, it is called &lt;code&gt;Hugo-ink-master.&lt;/code&gt; Rename the folder to &lt;code&gt;ink&lt;/code&gt; and then move it inside the &lt;code&gt;themes&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;Your Hugo project should now look like this:&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fink_directory_listing.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fink_directory_listing.png" alt="Ink Directory listing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside of the &lt;code&gt;ink&lt;/code&gt; theme folder is another folder called &lt;code&gt;exampleSite.&lt;/code&gt; This folder contains some example content that we can use to populate our site with some pages and posts.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the directory &lt;code&gt;themes/ink/exampleSite/archetypes/&lt;/code&gt; and replace &lt;code&gt;/archetypes/&lt;/code&gt; located at the project's root.&lt;/li&gt;
&lt;li&gt;Copy the directory &lt;code&gt;themes/ink/exampleSite/content/&lt;/code&gt; and replace &lt;code&gt;/content/&lt;/code&gt; located at the root of the project.&lt;/li&gt;
&lt;li&gt;Copy the directory &lt;code&gt;themes/ink/exampleSite/data/&lt;/code&gt; and replace &lt;code&gt;/data/&lt;/code&gt; located at the project's root.&lt;/li&gt;
&lt;li&gt;Copy the file &lt;code&gt;themes/ink/exampleSite/config.toml&lt;/code&gt; and replace &lt;code&gt;config.toml&lt;/code&gt; located at the root of the project.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now run the following command in your terminal to start the Hugo server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Hugo serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is configured and set up correctly, you should see the following at &lt;code&gt;http://localhost:1313/&lt;/code&gt;&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fink-home-page.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fink-home-page.jpg" alt="Harbor Home Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Your site might have a white background, which is fine; the theme has both light and dark themes, which are toggled based upon your system preferences.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Instant Reload &amp;amp; Creating new posts
&lt;/h2&gt;

&lt;p&gt;Hugo's built-in dev server will automatically reload the page whenever it detects a page. You can see this in action by modifying one of the posts located at &lt;code&gt;content/posts/.&lt;/code&gt; If you make any changes to one of these files, the browser will reload and update with your changes virtually instantly! Pretty sweet right 😎&lt;/p&gt;

&lt;p&gt;To create a new post, you will either have to stop the Hugo server, or open up another terminal window in the project directory and run the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hugo new posts/my-first-post.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Feel free to name the file whatever you like. You will need to modify what is known as the &lt;a href="https://gohugo.io/content-management/front-matter" rel="noopener noreferrer"&gt;Front Matter&lt;/a&gt; at the top of the file.&lt;/p&gt;

&lt;p&gt;If you open up one of the sample posts, you will see something like the following at the top:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Markdown&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Syntax&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Guide'&lt;/span&gt;
&lt;span class="na"&gt;date&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2019-03-11'&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;Sample&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;article&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;showcasing&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;basic&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Markdown&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;syntax.'&lt;/span&gt;
&lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;markdown&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;CSS&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;HTML&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;themes&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;categories&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;themes&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;syntax&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This data is what Hugo uses to generate various data on our site.&lt;/p&gt;

&lt;p&gt;This data is entirely customizable by you. With the correct theme and configuration modifications, you can have Hugo parse and use all kinds of custom data in the &lt;code&gt;Front Matter.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Take the example I used above and paste it into your new post.&lt;/p&gt;

&lt;p&gt;Here is what my post looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
title: 'My First Post'
date: '2020-12-12'
description: 'This is the description of my first post'
tags: [markdown]
categories: [syntax]
---

Content goes here...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The homepage should have been updated with your latest post and should look something like this:&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnew-post.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnew-post.jpg" alt="New post on the home page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pushing our project to GitHub
&lt;/h2&gt;

&lt;p&gt;Before we can deploy our site, we need to first push our site up to GitHub.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;If you do not have a &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; account, please sign up for a free account as you are going to need it throughout this course.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;**Your GitHub may not be dark like mine. I am using their dark theme, which is _not&lt;/em&gt; enabled by default.**_&lt;/p&gt;

&lt;p&gt;Create a new repository by clicking the &lt;code&gt;+&lt;/code&gt; in the upper right-hand corner, next to the bell icon, then "New repository."&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnew-repo.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnew-repo.jpg" alt="GitHub create new repository"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill out the repository name and description field and choose whether to make the repo private or public. It doesn't matter which one you choose. Netlify will work with both public and private repos.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub_create_repo.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub_create_repo.png" alt="GitHub create repo screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click the green button "Create repository."&lt;/p&gt;

&lt;p&gt;You should see a screen that looks similar to this:&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub_empty_repo.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub_empty_repo.png" alt="GitHub empty repo screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;This next section requires you to have &lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;Git&lt;/a&gt; installed. If you do not have Git installed, you can download it &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Head back over to your terminal inside your Hugo directory and run the following, in this order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init &lt;span class="c"&gt;# initializes a new git repository&lt;/span&gt;
git add &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="c"&gt;# adds all of the files to Git&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"init commit"&lt;/span&gt; &lt;span class="c"&gt;# creates a new commit with the message "init commit"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you are going to need to copy the URL for your git repo in GitHub. You can find it in this section of your empty GitHub repo.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub-instructions.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub-instructions.jpg" alt="GitHub empty repo instructions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste it into your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin git@github.com:robertguss/hugo-blog.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Refresh GitHub, and you should see the following:&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub-repo-pushed.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fgithub-repo-pushed.jpg" alt="GitHub repo pushed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you are all set and ready to deploy with Netlify.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying to Netlify
&lt;/h2&gt;

&lt;p&gt;Now that our site is all set up and running, let's learn how to deploy our static site to &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt;. Netlify is free and is one of the most popular hosting providers for the Jamstack. Head on over to their site, and sign up for an account; use your GitHub account to sign up.&lt;/p&gt;

&lt;p&gt;Once you sign up, you should land on a dashboard that looks like the following:&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-dashboard.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-dashboard.jpg" alt="Netlify Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the "New site from Git" button.&lt;/p&gt;

&lt;p&gt;On the next screen, click on the "GitHub" button.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-git-provider.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-git-provider.jpg" alt="Netlify Connect to Git Provider"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will want to connect your GitHub account to Netlify and give them access to all of your repos.&lt;/p&gt;

&lt;p&gt;You will then need to search for the repo we just created and select it. I named mine &lt;code&gt;Hugo-blog&lt;/code&gt; so I can easily search for it in the search bar.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-pick-a-repo.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-pick-a-repo.jpg" alt="Netlify Pick a repository"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It should automatically detect that this is a Hugo project and fill in the form fields for you. Just in case it doesn't, the build command is &lt;code&gt;Hugo&lt;/code&gt;, and the publish directory is &lt;code&gt;public&lt;/code&gt;&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-deploy-settings.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-deploy-settings.png" alt="Netlify Deploy Settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click the green button "Deploy site."&lt;/p&gt;

&lt;p&gt;You will then go back to the site dashboard, where the site will begin to deploy. It shouldn't take very long before you see a random URL at the top.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-deployed-site-dashboard.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-deployed-site-dashboard.jpg" alt="Netlify Site Deployed Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the green URL; it should take you to our new Hugo site!&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-site-broken.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-site-broken.png" alt="Broken Site"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait!?! Why is our site broken?&lt;/p&gt;

&lt;p&gt;If we inspect our site using Chrome dev tools and open up the console, we can see we have some mixed content warnings and a reference to &lt;code&gt;http://example.org.&lt;/code&gt; Where is this URL coming from?&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fbroken-site-dev-console.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fbroken-site-dev-console.jpg" alt="Broken Site Dev Console"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you open up &lt;code&gt;config.toml&lt;/code&gt; you will see the following on line 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="py"&gt;baseURL&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"http://example.org/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change it to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;baseURL &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will need to add these changes to Git and push them up to GitHub.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"fixed base URL in config.toml"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once our change is on GitHub, Netlify will automatically detect this change and redeploy our site. This CI/CD comes for free from Netlify without us having to set up and configure anything! We simply push to our master branch, and Netlify takes care of the rest.&lt;/p&gt;

&lt;p&gt;If you refresh your Netlify URL, the site is now fixed.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-site-fixed.jpg" 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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify-site-fixed.jpg" alt="Netlify Site Fixed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrating Netlify CMS
&lt;/h2&gt;

&lt;p&gt;Now that we have our blog setup and deployed live on Netlify, we will now integrate &lt;a href="https://www.netlifycms.org" rel="noopener noreferrer"&gt;Netlify CMS&lt;/a&gt;, which allows us to update our content more easily. You can find the docs for the installation &amp;amp; setup &lt;a href="https://www.netlifycms.org/docs/add-to-your-site/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, we need to create an admin folder, which is where the CMS will live. We need to make this folder inside of &lt;code&gt;/static.&lt;/code&gt; This folder does not currently exist, so create a new folder called &lt;code&gt;static&lt;/code&gt; in the project's root and then within that another folder called &lt;code&gt;admin.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Within the &lt;code&gt;/static/admin&lt;/code&gt; folder create 2 new files: &lt;code&gt;index.html&lt;/code&gt; &amp;amp; &lt;code&gt;config.yml&lt;/code&gt;.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_cms_admin_folder.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_cms_admin_folder.png" alt="Netlify CMS Admin Folder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open up &lt;code&gt;static/admin/index.html&lt;/code&gt; and add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Content Manager&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Include the script that builds the page and powers Netlify CMS --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then within &lt;code&gt;static/admin/config.yml&lt;/code&gt; add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;backend&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;git-gateway&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we need to add a &lt;code&gt;collections:&lt;/code&gt; property to our &lt;code&gt;config.yml&lt;/code&gt;, which will let the CMS know about our posts' structure. The collections can be a little complicated at first, as there are many fields that the CMS provides. You can find out more details about them in the docs &lt;a href="https://www.netlifycms.org/docs/collection-types/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For our blog, add the following to &lt;code&gt;config.yml&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;collections&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# A list of collections the CMS should be able to edit&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;post'&lt;/span&gt; &lt;span class="c1"&gt;# Used in routes, ie.: /admin/collections/:slug/edit&lt;/span&gt;
    &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Post'&lt;/span&gt; &lt;span class="c1"&gt;# Used in the UI, ie.: "New Post"&lt;/span&gt;
    &lt;span class="na"&gt;folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;content/posts'&lt;/span&gt; &lt;span class="c1"&gt;# The path to the folder where the documents are stored&lt;/span&gt;
    &lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# Allow users to create new documents in this collection&lt;/span&gt;
    &lt;span class="na"&gt;fields&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# The fields each document in this collection have&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Title'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;title'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;string'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Publish&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Date'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;date'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;datetime'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Description'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;description'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;text'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Body'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;body'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;markdown'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Tags'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;tags'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Categories'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;categories'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire file should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;backend&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;git-gateway&lt;/span&gt;

&lt;span class="na"&gt;collections&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# A list of collections the CMS should be able to edit&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;post'&lt;/span&gt; &lt;span class="c1"&gt;# Used in routes, ie.: /admin/collections/:slug/edit&lt;/span&gt;
    &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Post'&lt;/span&gt; &lt;span class="c1"&gt;# Used in the UI, ie.: "New Post"&lt;/span&gt;
    &lt;span class="na"&gt;folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;content/posts'&lt;/span&gt; &lt;span class="c1"&gt;# The path to the folder where the documents are stored&lt;/span&gt;
    &lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# Allow users to create new documents in this collection&lt;/span&gt;
    &lt;span class="na"&gt;fields&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# The fields each document in this collection have&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Title'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;title'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;string'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Publish&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Date'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;date'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;datetime'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Description'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;description'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;text'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Body'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;body'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;markdown'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Tags'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;tags'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Categories'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;categories'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we need to let Netlify CMS know where to put the images that we upload. We can do so by adding the following to our config.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;media_folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;static/images/uploads'&lt;/span&gt; &lt;span class="c1"&gt;# Folder where user uploaded files should go&lt;/span&gt;
&lt;span class="na"&gt;public_folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/images/uploads'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire file should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;backend&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;git-gateway&lt;/span&gt;

&lt;span class="na"&gt;media_folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;static/images/uploads'&lt;/span&gt; &lt;span class="c1"&gt;# Folder where user uploaded files should go&lt;/span&gt;
&lt;span class="na"&gt;public_folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/images/uploads'&lt;/span&gt;

&lt;span class="na"&gt;collections&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# A list of collections the CMS should be able to edit&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;post'&lt;/span&gt; &lt;span class="c1"&gt;# Used in routes, ie.: /admin/collections/:slug/edit&lt;/span&gt;
    &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Post'&lt;/span&gt; &lt;span class="c1"&gt;# Used in the UI, ie.: "New Post"&lt;/span&gt;
    &lt;span class="na"&gt;folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;content/posts'&lt;/span&gt; &lt;span class="c1"&gt;# The path to the folder where the documents are stored&lt;/span&gt;
    &lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# Allow users to create new documents in this collection&lt;/span&gt;
    &lt;span class="na"&gt;fields&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# The fields each document in this collection have&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Title'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;title'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;string'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Publish&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Date'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;date'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;datetime'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Description'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;description'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;text'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Body'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;body'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;markdown'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Tags'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;tags'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Categories'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&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;categories'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's push up our changes to that our latest code is on Netlify.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"installed Netlify CMS"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let's setup Netlify Identity, Netlify's built-in authentication service, to log into our cms.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_identity.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_identity.png" alt="Netlify Identity"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Within your Netlify site's dashboard, click on &lt;code&gt;Site settings&lt;/code&gt; at the top and then &lt;code&gt;Identity&lt;/code&gt; on the left sidebar. Then click on the Green "Enable Identity" button.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_registration_preferences.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_registration_preferences.png" alt="Netlify Registration Preferences"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can leave the "Open" radio button selected for now and click "Save."&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_registration_preferences_open.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_registration_preferences_open.png" alt="Netlify Registration Preferences Open"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll down towards the bottom of the page and click on "Enable Git Gateway" under the "Services" heading.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_services_git_gateway.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_services_git_gateway.png" alt="Netlify Enable Git Gateway"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Netlify Identity Widget
&lt;/h3&gt;

&lt;p&gt;Next, we need to install the Netlify Identity Widget, which will allow us to interact with Netlify Identity for authentication and logging into the CMS.&lt;/p&gt;

&lt;p&gt;Add this script include to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section of &lt;code&gt;/static/admin/index.html&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://identity.netlify.com/v1/netlify-identity-widget.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire file &lt;code&gt;/static/admin/index.html&lt;/code&gt; should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Content Manager&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://identity.netlify.com/v1/netlify-identity-widget.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Include the script that builds the page and powers Netlify CMS --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to install this to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of our Hugo static site so that it is included on every page. Paste inside of the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of &lt;code&gt;/themes/ink/layouts/partials/header.html.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That entire file should look like this now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  {{- $title := ( .Title ) -}} {{- $siteTitle := ( .Site.Title ) -}} {{- if
  .IsHome -}}
  &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;
    {{ $siteTitle }} {{ if isset .Site.Params "subtitle" }}- {{
    .Site.Params.Subtitle }}{{ end }}
  &lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  {{- else -}}
  &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;{{ $title }} - {{ $siteTitle }}&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  {{- end -}} {{- if isset .Site.Params "favicon" -}}
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"icon"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"image/png"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{"&lt;/span&gt; &lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="na"&gt;Site.Params.favicon&lt;/span&gt; &lt;span class="err"&gt;}}&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  {{- end -}}

  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  {{ with .OutputFormats.Get "rss" -}} {{ printf `
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"%s"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"%s"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"%s"&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"%s"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  ` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} {{-
  template "_internal/schema.html" . -}} {{- template "_internal/opengraph.html"
  . -}} {{- template "_internal/twitter_cards.html" . -}}
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
    &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.googleapis.com/css?family=Playfair+Display:700"&lt;/span&gt;
    &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/css"&lt;/span&gt;
  &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
    &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/css"&lt;/span&gt;
    &lt;span class="na"&gt;media=&lt;/span&gt;&lt;span class="s"&gt;"screen"&lt;/span&gt;
    &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ .Site.BaseURL }}css/normalize.css"&lt;/span&gt;
  &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
    &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/css"&lt;/span&gt;
    &lt;span class="na"&gt;media=&lt;/span&gt;&lt;span class="s"&gt;"screen"&lt;/span&gt;
    &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ .Site.BaseURL }}css/main.css"&lt;/span&gt;
  &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  {{- if isset .Site.Params "customcss" }}
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
    &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/css"&lt;/span&gt;
    &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ .Site.BaseURL }}{{ .Site.Params.customCSS }}"&lt;/span&gt;
  &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  {{ end }}

  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
    &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"dark-scheme"&lt;/span&gt;
    &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/css"&lt;/span&gt;
    &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ .Site.BaseURL }}css/dark.css"&lt;/span&gt;
  &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  {{- if isset .Site.Params "customdarkcss" }}
  &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
    &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"dark-scheme"&lt;/span&gt;
    &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/css"&lt;/span&gt;
    &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ .Site.BaseURL }}{{ .Site.Params.customDarkCSS }}"&lt;/span&gt;
  &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  {{- end }} {{ if and (isset .Site.Params "social") (isset .Site.Params
  "feathericonscdn") (eq .Site.Params.featherIconsCDN true) -}}
  &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  {{- else if or (isset .Site.Params "social") (eq .Site.Params.mode "auto") (eq
  .Site.Params.mode "dark") -}}
  &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"{{ .Site.BaseURL }}js/feather.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  {{ end }}
  &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"{{ .Site.BaseURL }}js/main.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  {{- if isset .Site.Params "customjs" -}} {{- range .Site.Params.customJS }}
  &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"{{ $.Site.BaseURL }}{{ . }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  {{- end }} {{- end }}
  &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://identity.netlify.com/v1/netlify-identity-widget.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our final step is to include a simple JS snippet that Netlify provides us in their install docs. This snippet will handle the redirection to the CMS admin dashboard upon successfully logging in.&lt;/p&gt;

&lt;p&gt;Add the following snippet to &lt;code&gt;/themes/ink/layouts/partials/footer.html.&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;init&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="nx"&gt;user&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="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;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;login&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/admin/&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="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire file should now look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"footer wrapper"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
      {{ dateFormat "2006" now }} {{ with .Site.Copyright }} {{ . | safeHTML }}
      | {{ end }} &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://github.com/knadh/hugo-ink"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Ink&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt; theme on
      &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://gohugo.io"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hugo&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

{{ template "_internal/google_analytics_async.html" . }} {{- with
.Site.Params.Social -}}
&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="nx"&gt;feather&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
{{- end -}}

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;init&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="nx"&gt;user&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="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;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;login&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/admin/&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="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's push up our changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"added Netlify Identity"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now navigate to your Netlify URL and add &lt;code&gt;/admin&lt;/code&gt; at the end. For instance, mine is &lt;code&gt;https://reverent-liskov-4cbe35.netlify.app/admin&lt;/code&gt;.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_identity_login.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_identity_login.png" alt="Netlify Identity Login"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the "Login with Netlify Identity" button.&lt;/p&gt;

&lt;p&gt;Then click on the "Sign up" tab, fill out the form and click the "Sign up" button.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;em&gt;Make sure to use your actual email address as you will need to click a link to confirm your identity.&lt;/em&gt;*&lt;/em&gt;&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_identity_signup.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_identity_signup.png" alt="Netlify Identity Signup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the email and confirm your email address. You should now be logged in and presented with the CMS admin dashboard.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_cms_dashboard.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_cms_dashboard.png" alt="Netlify CMS Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can now edit and create new posts with Netlify CMS!&lt;/p&gt;

&lt;p&gt;Open up one of the posts, edit some of the content, and click on the "Publish" button in the upper right-hand corner. &lt;/p&gt;

&lt;p&gt;Then click "Publish Now."&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_cms_publish_btn.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_cms_publish_btn.png" alt="Netlify CMS Publish Button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking this button will send a webhook to Netlify, which will begin to build and deploy the site automatically. Pretty slick 😎&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;One thing to keep in mind is that when you publish your site via the CMS, Netlify is creating Git commits for you in the background. So if you make some changes to your site via the CMS, make sure you run &lt;code&gt;git pull&lt;/code&gt; to pull down your repo's latest changes. Otherwise, your local copy and the version up on GitHub will be out of sync.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrating Zapier for automatic deploys
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;I learned this neat trick from Flavio Copes. You can check his post &lt;a href="https://flaviocopes.com/netlify-auto-deploy/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This next section includes using a service known as &lt;a href="https://zapier.com/" rel="noopener noreferrer"&gt;Zapier&lt;/a&gt;, an automation framework that we will utilize to deploy our site automatically. You may be wondering why we would need this or what is the use case. Let me explain.&lt;/p&gt;

&lt;p&gt;More often than not, most people write blog articles in advance and then schedule a publish date sometime in the future. For instance, you may want to publish a new blog post every two weeks or once a month and will often have several articles ready to go so that you have a "buffer" of content before you have to write more. Virtually every blogging system and cms allow this when you have a traditional monolithic architecture like WordPress or similar. However, since this is a static site and we do not have a backend, how can we accomplish this? The key is to use Zapier and Hugo's publish date. &lt;/p&gt;

&lt;p&gt;Hugo has this feature built-in already, where if you have a date set for one of your articles in the future, it will not build the page until that date. For example, if I set the date two weeks from today, Hugo will not make that page until then. We can trigger as many builds of our site as we want, and that article will not show up until two weeks from today. &lt;/p&gt;

&lt;p&gt;Knowing this, we can then use Zapier to send a webhook to Netlify at whatever interval we want, which will trigger a new build. So if you are publishing every two weeks, you can set up Zapier to send a webhook every two weeks. You could even have Zapier send a webhook every single day if your schedule is inconsistent. That way, you only have to worry about setting the correct date in the articles front-matter, and the deployment and publishing cycle is handled for you automatically!&lt;/p&gt;

&lt;p&gt;For this tutorial, we will be setting up Zapier to send a webhook every day.&lt;/p&gt;

&lt;p&gt;Before we can set up Zapier, we need first to configure Netlify to accept our Webhook from Zapier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Netlify Webhook Setup
&lt;/h3&gt;

&lt;p&gt;Head back over to your Netlify dashboard and click on "Site settings" and then "Build &amp;amp; deploy" on the left sidebar. Scroll down until you see a "Build hooks" section.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_build_hooks.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_build_hooks.png" alt="Netlify Build Hooks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the "Add build hook" button.&lt;/p&gt;

&lt;p&gt;Give your hook a name, and then save it.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_build_hook_name.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_build_hook_name.png" alt="Netlify Build Hook Name"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Netlify will then give you a URL for the webhook, like so:&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_build_hook_url.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_build_hook_url.png" alt="Netlify Build Hook Url"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy this down or keep this tab open as we will need this Url for Zapier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Zapier Webhook Setup
&lt;/h3&gt;

&lt;p&gt;Head on over to &lt;a href="https://zapier.com/" rel="noopener noreferrer"&gt;Zapier&lt;/a&gt; and create a free account. After logging in, Go to this [link (&lt;a href="https://zapier.com/apps/schedule/integrations/webhook/2845/send-webhook-post-requests-on-a-daily-schedule" rel="noopener noreferrer"&gt;https://zapier.com/apps/schedule/integrations/webhook/2845/send-webhook-post-requests-on-a-daily-schedule&lt;/a&gt;) to see how to configure a &lt;a href="https://zapier.com/apps/schedule/integrations/webhook/2845/send-webhook-post-requests-on-a-daily-schedule" rel="noopener noreferrer"&gt;webhook POST request&lt;/a&gt;.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_webook_post.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_webook_post.png" alt="Zapier Webhook Post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the "Try it" button.&lt;/p&gt;

&lt;p&gt;On the next screen, I set up mine to trigger on the weekends and at 7 am.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_every_day.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_every_day.png" alt="Zapier Webhook Post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After clicking "Save and Continue," click on the "Test Trigger" button.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_test_trigger.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_test_trigger.png" alt="Zapier Test Trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click on the 2nd section and add in the URL from Netlify. I set my payload type to "Raw."&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_post_setup.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_post_setup.png" alt="Zapier Post Setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can leave the rest of the fields as they are and then click "Save and continue."&lt;/p&gt;

&lt;p&gt;You will then see a "Test action" screen. Click the "Test &amp;amp; Continue" button.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_test_action.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_test_action.png" alt="Zapier Test Action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If all goes well, you should see the following.&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_test_success.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fzapier_test_success.png" alt="Zapier Test Success"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click on the "Turn on Zap" button to enable it.&lt;/p&gt;

&lt;p&gt;Head back to your Netlify dashboard and see if the CI/CD was triggered. Click on "Deploys" at the top of the screen and check to see the latest deploy. It should say something like "Deploy triggered by hook: Zapier at 7 am"&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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_hook_success.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%2Fhowtocode.io%2Fassets%2Fjamstack-hugo-blog%2Fnetlify_hook_success.png" alt="Netlify Hook Success"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zapier will send a webhook at 7 am every day, and Netlify will deploy a fresh copy of your site at the same time. All you have to do is enter the date in your article's front-matter on which you would like your article to be published live on your site, and the rest is handled for you automatically!&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Repo
&lt;/h2&gt;

&lt;p&gt;You can find the completed project here inside of &lt;code&gt;Hugo-Blog/final&lt;/code&gt; &lt;br&gt;
&lt;a href="https://github.com/robertguss/howtocode-understanding-the-jamstack" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we learned how to create a Jamstack site using the Hugo static site generator. We also integrated Netlify CMS to make it easy to update our content and deployed our site to Netlify. Finally, we set up Zapier to trigger automatic deploys on Netlify every day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Jamstack Book
&lt;/h2&gt;

&lt;p&gt;My book Understanding the Jamstack is "pay what you want." You can get it for free by entering &lt;code&gt;0&lt;/code&gt; for the price at checkout.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gum.co/understanding-the-jamstack" rel="noopener noreferrer"&gt;Buy Understanding the Jamstack&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How I taught myself how to code and got hired as a junior developer in 5 months</title>
      <dc:creator>Robert Guss</dc:creator>
      <pubDate>Tue, 05 Jan 2021 00:42:42 +0000</pubDate>
      <link>https://dev.to/howtocode_io/how-i-taught-myself-how-to-code-and-got-hired-as-a-junior-developer-in-5-months-fdj</link>
      <guid>https://dev.to/howtocode_io/how-i-taught-myself-how-to-code-and-got-hired-as-a-junior-developer-in-5-months-fdj</guid>
      <description>&lt;p&gt;Before I get into my story, I want to preface this article with a few things. I am typically a shy and introverted person. I am not the kind of person who openly discusses my achievements and successes, especially when it comes to finances. I don't like bragging or boasting, and this article is taking me way outside of my comfort zone. &lt;/p&gt;

&lt;p&gt;My primary reason for writing this article is to help inform, inspire, and motivate those of you out there looking to learn how to code, especially those of you who are self-taught. I wish I could have read a story like mine when I was first learning to code over six years ago. I always want to make sure I am 100% open, honest, and transparent.&lt;/p&gt;

&lt;p&gt;I am currently 35 years old and did not learn how to code until I was 29. So no, you are never too old, nor is it ever too late for you to learn anything... especially code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Before learning how to code, I had all kinds of jobs. I have been working since I was 15. I worked as a busboy for a few restaurants while in high school. I worked in retail, at a CVS in a shopping mall (one of the worst jobs ever!), and in real estate for over 6 years. I had a pretty good job/career in real estate until the entire economy collapsed in 2008. I was living in Florida at the time, and the real estate market there took a particularly devasting hit.&lt;/p&gt;

&lt;p&gt;The 2008 economic crisis was one of the best things that ever happened to me. I took a good look at myself, my life and did some soul searching. Seeing how real estate was not coming back for a long time, and I didn't honestly enjoy it all that much, what was I going to do? I figured I would go back to college and get my bachelor's degree in hopes that the economy would bounce back after those four years in school. I was 24.&lt;/p&gt;

&lt;p&gt;In case you are wondering what I did during those six years between high school and college, I worked and played in a band. Music was my life. I had been a musician since I was 13 or 14 years old. Going back to school seemed daunting and dreadful. I hated high school. I was bored all the time and never really interested in any of the subjects I was being taught. Also, math was my worst subject and still is to this day. You don't need to be a math wiz to learn how to code! I wish someone had told me this earlier, but I digress.&lt;/p&gt;

&lt;p&gt;Being a musician, I thought I would apply to a music school to study what I loved more than anything. Only one school came to mind, Berklee College of Music. I told myself that going to college would only be worth it if I could study at Berklee. I didn't want to go anywhere else and wouldn't have accepted any other college. Berklee is the best there is. If I was going to spend four years of my life in school while getting into a whole bunch of debt, then I was going to go to the best of the best. &lt;/p&gt;

&lt;p&gt;It was the only school I had applied to, and to my surprise, I was accepted. The reason why I was surprised is that I was self-taught in music too. I never had a private lesson or a guitar teacher. I couldn't read music, I didn't know any scales, theory, or any of that stuff... but I could play. I had been playing in bands for several years and had played countless shows up until that point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reality Check
&lt;/h2&gt;

&lt;p&gt;So I packed up my car and moved to Boston to go to Berklee. Those four years were some of the most incredible years of my life. I graduated with a Composition degree, which basically means I learned how to compose 'classical' music. This is not exactly a high-paying in-demand skill these days, but I didn't care. For me, it was the best program/degree to get the most out of the school, and I don't regret that decision. However, I knew once I declared my major in composition, I would most likely have to fall back on my IT skills.&lt;/p&gt;

&lt;p&gt;I was always interested in computers and taught myself how to fix them while in high school. I really just did it out of fun &amp;amp; curiosity. I also broke my computers all the time and couldn't afford to pay anyone to fix them, so I just figured it out, thanks to the internet.&lt;/p&gt;

&lt;p&gt;After graduating, that is when reality really set in. My first student loan payment came, and it was well over $1,000. I had graduated with around $115,000 in student loan debt. I basically had a mortgage, but no house. That was a sobering experience. Naturally, I panicked.&lt;/p&gt;

&lt;p&gt;I needed a well-paying job as I worked for various production companies and made a little over $30,000 a year. I was also living at home with my parents and was about to turn 30.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bootcamp that never was
&lt;/h2&gt;

&lt;p&gt;What first got me interested in programming was a computer game I used to play called DayZ. It is an online multiplayer game where you try to survive from other players and zombies. All good games have zombies in them. I eventually decided to rent my own server to host my own version of the game for others to play on. &lt;/p&gt;

&lt;p&gt;One of the coolest aspects of the game was that it was a "mod." This means it was built on top of another game, Arma 2. So I could install various other mods/plugins that would completely change the functionality of the game. I had no idea how to code, but I found all of these various articles and YouTube videos that showed me how to modify the game. I copied the code snippets, pasted them in the right places, and it just worked! I had no clue what I was doing, but I found it fascinating this was even possible. That was the first time I experienced the power of programming.&lt;/p&gt;

&lt;p&gt;I did some searching online to learn how to code and came across a Bootcamp in Boston called &lt;a href="https://launchacademy.com/"&gt;Launch Academy&lt;/a&gt;. I went to their open house, filled out an application, and to my surprise, I got in. I have no idea if this was a big deal or not, they probably accept pretty much anyone, but it felt like a big deal to me. Then another reality check... the cost!&lt;/p&gt;

&lt;p&gt;The program was three months or so and over $12,000. There was no way I could afford that! Nor was I willing to get into even further debt on top of all of my student loan debt. I tried to negotiate with them but got nowhere. Then I had an idea...&lt;/p&gt;

&lt;p&gt;What if I put myself through my own Bootcamp? I mean, these people say they can teach me the skills I need to get a high paying coding job in three months, so why can't I just do this myself. I have taught myself IT and music before, so why not coding? So that is what I did.&lt;/p&gt;

&lt;p&gt;My jobs working for production companies were notoriously slow from the end of the year into the beginning of the year. So, I had a few months where I wasn't really working anyway. I took full advantage of this 'downtime' and got to work. I spent a good 6-8 hours every day, seven days a week learning HTML, CSS, JavaScript, Ruby, and Ruby on Rails. The Bootcamp had given me a couple books and let us know what we would be learning, so I just searched the internet for resources to learn all of those technologies. &lt;/p&gt;

&lt;p&gt;I read &lt;a href="https://learn.shayhowe.com/html-css/"&gt;Shay Howe's book for HTML/CSS&lt;/a&gt; and &lt;a href="https://pine.fm/LearnToProgram/"&gt;Chris Pine's book for Ruby&lt;/a&gt;. I don't remember which books I read for JS or rails. I was also taking several courses on Udemy. I bought every Ruby on Rails and JavaScript course I could afford. I bounced from tutorial to tutorial, course to course, and wasted so much time. I had no idea what I was doing. I wish I had a mentor or someone who could show me the proper order of what to learn and when. I really needed some kind of curriculum, but I just had to figure it out. &lt;/p&gt;

&lt;h2&gt;
  
  
  My first job
&lt;/h2&gt;

&lt;p&gt;I was insanely driven and dedicated to learning how to code to get a better paying job, move out, and pay off my debt. After 3 months or so, I started getting freelance gigs on eLance, which doesn't exist anymore. I think it is now called Upwork. I had zero experience doing web development, so I worked basically for free. I made some money. I charged like $50 for a website or something crazy like that. I didn't care though I was getting real-world experience and building my portfolio. I didn't care if the quality wasn't excellent, because what do you expect for $50? Don't get me wrong though, I worked my butt off for those clients. I went above and beyond to try and deliver the best product I could. It wasn't about money yet. I just needed the experience. &lt;/p&gt;

&lt;p&gt;Five months later, I decided to try and apply for some junior developer positions. I had no idea what I was getting into and figured that I could get some practice interviewing. I took the interviews as a learning experience, as well. When someone would ask me something I didn't know, I wrote it down and looked it up later. &lt;/p&gt;

&lt;p&gt;I eventually applied to a music company in Rhode Island. Here is my &lt;a href="https://howtocode.io/assets/my-code-story/cover-letter.pdf"&gt;cover letter&lt;/a&gt; and &lt;a href="https://howtocode.io/assets/my-code-story/resume.pdf"&gt;resume&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;You will notice in my resume that I just have the years for my experience and not the months. This was intentional. I started learning to code in December of 2014. 😏&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I got the job. I was offered $55,00. Here is the &lt;a href="https://howtocode.io/assets/my-code-story/inmusic-offer-letter.pdf"&gt;offer letter&lt;/a&gt;. To be honest, the only reason I think I was hired is because of my strong music background. I was a terrible developer and didn't know what I was doing, but my music skills got me in the door. &lt;/p&gt;

&lt;p&gt;This is an important thing for new people trying to break into the industry. Use what experience you do have to try and get into tech. You may have a lot of experience in retail, restaurants, education, whatever. Try to get a coding job in those fields first. People looking to hire junior developers know you don't have great coding skills, so leverage the skills and experience you do have.&lt;/p&gt;

&lt;p&gt;Getting a coding job is not easy, even though the demand is through the roof for developers. You need a way to stand out, as any company hiring a junior developer is taking a pretty significant risk. They know you don't have what it takes to solve complex problems and that you will need a lot of support at first. However, they hope you will grow out of your 'junior' shell in a reasonable amount of time to really start contributing. &lt;/p&gt;

&lt;p&gt;Your number one priority as a junior dev is to learn as much as you can from the more experienced devs around you. Then you need to get that 'junior' out of your job title asap. The next jobs are so much easier once you have some real-world experience under your belt. The first one is definitely the hardest, at least in my experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Job 2
&lt;/h2&gt;

&lt;p&gt;After working for InMusic for a couple of years or so, I began working for an agency based in New York. I was still living in RI at the time, so this was my first full-time remote gig, and I loved it! Working remote is fantastic, and I wouldn't have it any other way now. However, I don't think remote is a good idea for your first job. You should try to find a company local to you so you can get first-hand experience from other devs in person. You can do it remotely if you want. Still, I think you get so much more experience and value out of being with other devs, face to face, especially when you are just starting out. &lt;/p&gt;

&lt;p&gt;I asked them for $80,000, which was $20,000 more than I was making. I got a $5,000 raise after my first year at inMusic and was promoted to a front-end developer. They offered me $72,000 and told me after my first year, they would pay me $80,000. I said yes and put in my two weeks. &lt;/p&gt;

&lt;h2&gt;
  
  
  Today
&lt;/h2&gt;

&lt;p&gt;Today I am a senior software engineer for a travel insurance company in Rhode Island. I work remotely from Pennsylvania. I make just shy of $100,000. I have been there for over two years now. So in five years or so, I went from making just over $30,000 to almost $100,000. Not only has my salary increased significantly, but I have much better benefits, more time off, etc. The best part is that even with all of my debt, and my wife's for that matter, I can support my family so my wife can raise our two small children. &lt;/p&gt;

&lt;p&gt;Plus, I really love what I do. I am crazy passionate about this stuff. It is incredible to make a good salary in a high demand field, doing what I love. &lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up &amp;amp; Advice
&lt;/h2&gt;

&lt;p&gt;My story is simply that... my story. Yours will be quite different. I hope that reading my story has encouraged and inspired you. Yes, you can do this! You do not need to be a math genius or have any prior experience. You just have to want it! If you are in this solely for the money, look for something else. You will not be happy making more money doing something you hate, trust me! It's not worth it. &lt;/p&gt;

&lt;p&gt;If you really want to do this, then nothing is stopping you. There are more free resources out there than ever before. This site is only one of them. I  am trying to take all of the experience I have and teach it to others. I wish I had someone like myself to help me out along the way. I would have saved so much time, money, and effort if I had a mentor. I hope this site, my books, courses, and YouTube videos will do that for you. You can always reach out to me on &lt;a href="https://twitter.com/howtocode_io"&gt;Twitter&lt;/a&gt; or email me &lt;code&gt;howtocode@pm.me.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;

&lt;p&gt;Robert&lt;/p&gt;

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