<?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: kn0wn</title>
    <description>The latest articles on DEV Community by kn0wn (@kn0wn).</description>
    <link>https://dev.to/kn0wn</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%2F371335%2F4787cbb4-4fb9-42da-a3b0-365716af8c5e.png</url>
      <title>DEV Community: kn0wn</title>
      <link>https://dev.to/kn0wn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kn0wn"/>
    <language>en</language>
    <item>
      <title>Staying static with Nuxt: Implementing Netlify CMS</title>
      <dc:creator>kn0wn</dc:creator>
      <pubDate>Sun, 26 Jul 2020 22:18:07 +0000</pubDate>
      <link>https://dev.to/kn0wn/staying-static-with-nuxt-implementing-netlify-cms-5d9b</link>
      <guid>https://dev.to/kn0wn/staying-static-with-nuxt-implementing-netlify-cms-5d9b</guid>
      <description>&lt;h3&gt;
  
  
  Nuxt v2.13
&lt;/h3&gt;

&lt;p&gt;If you haven't heard of nuxt yet and you're a vue developer, where have you been?&lt;/p&gt;

&lt;p&gt;As of Nuxt v2.13.0, a new config option for Nuxt has been introduced;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;static&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I won't go into detail about what this means for your static sites as Sébastien has already done a great job in the article &lt;a href="https://nuxtjs.org/blog/going-full-static"&gt;here&lt;/a&gt;, but this is one step closer to allowing us to have a full offering while being completely serverless.&lt;/p&gt;

&lt;p&gt;After reading this post, I thought about what would be a great way to fully test this new build. Luckily at the company I work for, &lt;a href="https://rcco.uk"&gt;RCCO (shamless plug)&lt;/a&gt;, we have been looking at solutions to allow us to post new job openings for the non-devs without having to manually create PR and merging them.&lt;/p&gt;

&lt;p&gt;After doing some research I found that Netlify, who we are already hosting our site on, actually have a great solution for this in the terms of &lt;a href="https://github.com/netlify/netlify-cms"&gt;NetlifyCMS&lt;/a&gt;. I had read about this a while back but the project was still very early in development and didn't offer quite enough in comparison to some of the competitors at the time, namely &lt;a href="https://www.storyblok.com/"&gt;Storyblok&lt;/a&gt;, however some time has passed, many more commits added and it now has everything we need.&lt;/p&gt;

&lt;h1&gt;
  
  
  Implementation
&lt;/h1&gt;

&lt;p&gt;The implementation of this already has a great tutorial &lt;a href="https://www.netlifycms.org/docs/nuxt/"&gt;here&lt;/a&gt; but this hasn't been updated to take advantage of the new &lt;code&gt;target: static&lt;/code&gt; that Nuxt now offers.&lt;/p&gt;

&lt;p&gt;We are going to implement NetlifyCMS into our application and then display the data on our website using @nuxt/content.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;This is going to assume you already have a project created and know the general points of Vue/Nuxt, if you're looking for some resources on a complete getting started, use the search above as there's some fantastic tutorials on getting started. Once you've done that make sure to come back to this one.&lt;/p&gt;

&lt;p&gt;I'm also going to reference sections on the Netlify documentation as there's no point creating an echo chamber that is just repeating the same information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting started
&lt;/h3&gt;

&lt;p&gt;To get started you need to first add the NetlifyCMS page to your Nuxt application, this is done by making an admin folder inside your &lt;code&gt;static&lt;/code&gt; folder with the file &lt;code&gt;index.html&lt;/code&gt;. Inside this html file, copy and paste the following code &lt;a href="https://www.netlifycms.org/docs/nuxt/#add-the-netlify-cms-files-to-nuxt"&gt;(check here for the latest version)&lt;/a&gt;;&lt;br&gt;
&lt;/p&gt;

&lt;div class="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="c"&gt;&amp;lt;!-- Include the script that enables Netlify Identity on this page. --&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;Now create the config file that is used for creating the fields needed for your post. So create &lt;code&gt;config.yml&lt;/code&gt; inside the same admin folder. Below is a basic version of the one we have implemented;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;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;branch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;

&lt;span class="na"&gt;media_folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;static/img&lt;/span&gt;
&lt;span class="na"&gt;public_folder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/img&lt;/span&gt;

&lt;span class="na"&gt;collections&lt;/span&gt;&lt;span class="pi"&gt;:&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;careers'&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;Careers'&lt;/span&gt;
    &lt;span class="na"&gt;format&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;json'&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/careers'&lt;/span&gt;
    &lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;slug&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{{slug}}'&lt;/span&gt;
    &lt;span class="na"&gt;fields&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;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;Start'&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;start'&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;Salary'&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;salary'&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;Summary'&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;summary'&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;Perks'&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;perks'&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;Type'&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;type'&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;select'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;options&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Full&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;time'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Part&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;time'&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Remote'&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="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;markdown'&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;For the full configuration options, check out the &lt;a href="https://www.netlifycms.org/docs/configuration-options/"&gt;documentation here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to create the area that we have stated for NetlifyCMS to push our content to, for this we are going to use the brand new &lt;a href="https://content.nuxtjs.org/"&gt;@nuxt/content module&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nuxt Content
&lt;/h3&gt;

&lt;p&gt;This is a new module from Nuxt that allows us to fetch our content and then manipulate it &lt;em&gt;through a MongoDB like API&lt;/em&gt;. What's great about this is that it means we can use a lot of advanced functions such as &lt;a href="https://content.nuxtjs.org/fetching#wherequery"&gt;where&lt;/a&gt; and &lt;a href="https://content.nuxtjs.org/fetching#sortbykey-direction"&gt;sortBy&lt;/a&gt; - We're not going to use these in this tutorial but keep them in mind for your own implementation. &lt;/p&gt;

&lt;p&gt;Follow the installation instructions detailed on the @nuxt/content documentation found &lt;a href="https://content.nuxtjs.org/installation"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All we need to do is specify to NetlifyCMS to place the content into our new content folder and then Nuxt will take care of the rest. For our use case we have called the folder &lt;code&gt;careers&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Netlify Authentication
&lt;/h3&gt;

&lt;p&gt;Now follow the section on the NetlifyCMS documentation that talks about enabling their Identity service to allow for signup/login, &lt;a href="https://www.netlifycms.org/docs/nuxt/#authenticating-with-netlify-identity"&gt;found here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I enabled the Google login service to make this even easier (Netlify, you are too good to us).&lt;/p&gt;

&lt;p&gt;Once that is done, push all the changes live and navigate to &lt;code&gt;${your_site}/admin&lt;/code&gt;, click sign up and create a new post. &lt;/p&gt;

&lt;h3&gt;
  
  
  Pulling your posts
&lt;/h3&gt;

&lt;p&gt;Once you have added your content and NetlifyCMS has committed the post to master, pull latest and check &lt;code&gt;content/careers&lt;/code&gt;. We are going to use this data for the rest of the tutorial so make sure this is working first before continuing. &lt;/p&gt;

&lt;p&gt;Now we have a post created, we need to tell Nuxt about it, this is done using the &lt;code&gt;nuxtServerInit&lt;/code&gt; action that is created in &lt;code&gt;store/index.js&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;state&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="na"&gt;careers&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;mutations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;setCareers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;list&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;careers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;list&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;actions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;nuxtServerInit&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;commit&lt;/span&gt; &lt;span class="p"&gt;},&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="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;careers&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;$content&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;careers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;setCareers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;careers&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 using the @nuxt/content module to add all our posts to the store for ease of use. Now Nuxt knows about our career posts we can use the data to display on the website.&lt;/p&gt;

&lt;h3&gt;
  
  
  The beauty in Nuxt
&lt;/h3&gt;

&lt;p&gt;Now that we have given Nuxt the information it needs to find where our posts are, the magic of &lt;code&gt;target: static&lt;/code&gt; fully comes into affect. Before the issue of using the &lt;code&gt;nuxt generate&lt;/code&gt; command was that it couldn't handle dynamic urls as it didn't know what content was needed to create these pages. Now being &lt;em&gt;fully static&lt;/em&gt; nuxt runs a crawler on build and one of the areas it checks is the &lt;code&gt;nuxtServerInit&lt;/code&gt; to see what we are looking for &lt;a href="https://nuxtjs.org/blog/going-full-static#crawler-integrated"&gt;(Read more here)&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The NetlifyCMS continues here about implementing this into your site more, but I'm assuming now you have this data available you can handle it. It also has a great section about using &lt;a href="https://www.netlifycms.org/docs/nuxt/#rendering-markdown-with-nuxtjsmarkdownit"&gt;markdown&lt;/a&gt; which paired with the new &lt;a href="https://github.com/tailwindlabs/tailwindcss-typography"&gt;@tailwindcss/typography&lt;/a&gt; plugin creates a fancy CMS page editor with ease.&lt;/p&gt;

&lt;p&gt;You can also handle error pages by adding a page in the &lt;code&gt;layouts&lt;/code&gt; folder called &lt;code&gt;error.vue&lt;/code&gt; and then adding the following to your &lt;code&gt;nuxt.config.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;fallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;404.html&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;An example of this is with our &lt;a href="https://rcco.uk/careers/error"&gt;implementation here&lt;/a&gt;, have a play with the blocks, it was built with &lt;a href="https://github.com/liabru/matter-js"&gt;matter.js&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Final thoughts
&lt;/h3&gt;

&lt;p&gt;Nuxt and NetlifyCMS can be used to create something that only a couple of years ago was a huge job involving multiple teams working together. It's a very exciting time to be a Front-End developer (Well for me anyway).&lt;/p&gt;

&lt;p&gt;Thanks to the Nuxt team for creating such a great application and NetlifyCMS for making my life incredibly easy. Also thanks to all the contributors that help projects like these continue to thrive.&lt;/p&gt;

&lt;p&gt;If you want me to continue about creating the dynamic page and then using the data let me know and I'll check my schedule for openings. &lt;/p&gt;

&lt;h4&gt;
  
  
  Edit History
&lt;/h4&gt;

&lt;p&gt;27/07/2020 - Updated to use @nuxt/content and removed un-needed script in index.vue head&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>netlify</category>
      <category>cms</category>
      <category>headless</category>
    </item>
  </channel>
</rss>
