<?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: Steve Stedman</title>
    <description>The latest articles on DEV Community by Steve Stedman (@stedman).</description>
    <link>https://dev.to/stedman</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%2F322332%2Fdf613255-fe5f-4105-9983-b08aca683e30.png</url>
      <title>DEV Community: Steve Stedman</title>
      <link>https://dev.to/stedman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stedman"/>
    <language>en</language>
    <item>
      <title>Make the Jump from Jekyll to JavaScript</title>
      <dc:creator>Steve Stedman</dc:creator>
      <pubDate>Tue, 12 May 2020 20:20:29 +0000</pubDate>
      <link>https://dev.to/stedman/make-the-jump-from-jekyll-to-javascript-2550</link>
      <guid>https://dev.to/stedman/make-the-jump-from-jekyll-to-javascript-2550</guid>
      <description>&lt;p&gt;With the recent addition of &lt;a href="https://github.com/features/actions"&gt;Actions&lt;/a&gt; to GitHub's product lineup, we now have the ability to create a &lt;em&gt;100% Pure, Unfiltered™&lt;/em&gt; JavaScript alternative to Jekyll (and Ruby) in GitHub Pages. This is a big deal. Really.&lt;/p&gt;

&lt;h2&gt;
  
  
  Back story
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pages.github.com/"&gt;GitHub Pages&lt;/a&gt;, for the uninitiated, allows you to create websites from the source code stored in a GitHub repo. There are no databases to set up, no servers to provision, and no file transfers (at least not in the traditional sense). Better yet, it allows you to transform plain text into static websites and blogs with the help of Jekyll.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt; is a pretty sweet static site generator. It's been around quite awhile, is battle tested, and is backed by a huge community. It's also simple enough for beginners and yet powerful enough for advanced users. Unfortunately, customizing it requires running it locally and this is where things get sticky. Jekyll is based on Ruby. For casual users, Ruby is a challenge to set up and maintain—especially on Windows. Scaling is also an issue for Jekyll/Ruby as bigger builds are notorious for taking a long time to compile.&lt;/p&gt;

&lt;p&gt;While there are plenty of competitive static site generators out there, the one piece that was missing was the integrated of build and deploy to GitHub's web server. Pages+Jekyll took care of that build and deploy mumbo-jumbo for you, automagically. Just commit to the &lt;code&gt;gh-pages&lt;/code&gt; branch and &lt;strong&gt;poof&lt;/strong&gt;, your site is updated.&lt;/p&gt;

&lt;p&gt;More recently, workarounds from &lt;a href="https://netlify.com/"&gt;Netlify&lt;/a&gt; and others have popped up. They handle build/deploy and offer additional features worth considering, but at the end of the day they are yet another dependency to maintain.&lt;/p&gt;

&lt;p&gt;If only we could run a static site generator on Pages with all the hooks and privileges of Jekyll but with the ease-of-setup and performance provided by more modern alternatives.&lt;/p&gt;

&lt;p&gt;Well, now you can. All the pieces have finally fallen into place.&lt;/p&gt;

&lt;h2&gt;
  
  
  The build
&lt;/h2&gt;

&lt;p&gt;This brief tutorial will cover the essentials of migrating from Jekyll to JavaScript. The following are required to get started:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/"&gt;GitHub account&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nodejs.org/"&gt;NodeJS&lt;/a&gt; set up locally&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course, it would also make sense to already have an existing Jekyll repo. If not, then &lt;a href="https://github.com/new/"&gt;create a new GitHub repo&lt;/a&gt; (public or private) with a README initialized. Follow the follow-up instructions to clone and set it up locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set up the static site generator
&lt;/h3&gt;

&lt;p&gt;It took awhile for someone to distill the essence of Jekyll into JavaScript. With &lt;a href="https://11ty.dev"&gt;Eleventy&lt;/a&gt;, Zach Leatherman (&lt;a href="https://twitter.com/zachleat"&gt;@zachleat&lt;/a&gt;) has really distilled, bottled, and shipped it. Oh, and did I mention that it's fast? I'll skip the rest of the sales pitch here and let the experts do the talking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://daverupert.com/2019/08/what-i-like-about-eleventy/"&gt;Dave Rupert: What I Like About Eleventy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://iandroid.eu/why-im-digging-eleventy/"&gt;iandroid: Why I'm Digging Eleventy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://24ways.org/2018/turn-jekyll-up-to-eleventy/"&gt;Paul Lloyd: Turn Jekyll Up to Eleventy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you haven't already guessed, I'm smitten with Eleventy. It's that multi-purpose knife that fits just perfectly in your pocket and makes you smile every time you use it.&lt;/p&gt;

&lt;p&gt;It also makes the transition from Jekyll to JavaScript almost completely seamless. So let's roll with it.&lt;/p&gt;

&lt;h4&gt;
  
  
  Install and configure
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open a terminal and navigate to your repo.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you don't already have a &lt;code&gt;package.json&lt;/code&gt; file in the root directory, then take this moment to initialize npm.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install Eleventy as a &lt;code&gt;devDependency&lt;/code&gt;.&lt;br&gt;
&lt;/p&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;--save-dev&lt;/span&gt; @11ty/eleventy
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To the site root, add an empty &lt;code&gt;.nojekyll&lt;/code&gt; file to &lt;a href="https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators"&gt;disable the default Jekyll build&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; .nojekyll
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Keeping things simple, we'll assume a &lt;a href="https://jekyllrb.com/docs/structure/"&gt;default Jekyll file structure&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;..
├── _layouts
│   ├── default.html
├── assets
│   ├── css
│   ├── images
│   └── js
├── index.html
..
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;To the site root, add a &lt;code&gt;.eleventy.js&lt;/code&gt; config file with the following contents. For more details, see the &lt;a href="https://www.11ty.dev/docs/config/"&gt;Eleventy configuration docs&lt;/a&gt;.&lt;br&gt;
&lt;/p&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="nx"&gt;eleventyConfig&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Copy the "assets" directory to the compiled "_site" folder.&lt;/span&gt;
  &lt;span class="nx"&gt;eleventyConfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addPassthroughCopy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;assets&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="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;input&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="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./_site&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;layouts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./_layouts&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="na"&gt;templateFormats&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;html&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;liquid&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;md&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;njk&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;/code&gt;&lt;/pre&gt;


&lt;p&gt;Looking at the &lt;code&gt;dir.output&lt;/code&gt; above, notice that we are maintaining parity with Jekyll's deployment, using the &lt;code&gt;./_site&lt;/code&gt; directory for our compiled code.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To the &lt;code&gt;scripts&lt;/code&gt; section of &lt;code&gt;package.json&lt;/code&gt;, add the following. We'll need the &lt;code&gt;build&lt;/code&gt; script for our deployment later.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&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;"clean"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rm -rf ./_site"&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;"npm run clean &amp;amp;&amp;amp; 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;"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;"eleventy --serve --watch"&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;clean&lt;/strong&gt;: empties out the deployment directory&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;build&lt;/strong&gt;: cleans the deploy directory and builds the site with Eleventy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;start&lt;/strong&gt;: runs Eleventy in developer mode with live browser refreshes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The deployment
&lt;/h2&gt;

&lt;p&gt;Now for the real magic sauce, &lt;a href="https://docs.github.com/en/actions"&gt;GitHub Actions&lt;/a&gt;-style.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set up workflow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open a browser to your GitHub repo and then select the &lt;strong&gt;Actions&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Tap on the &lt;strong&gt;New workflow&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;Tap on the &lt;strong&gt;Set up a workflow yourself&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;{repo_name}/.github/workflows/&lt;code&gt;main.yml&lt;/code&gt;&lt;/strong&gt; field, enter "&lt;code&gt;eleventy_build.yml&lt;/code&gt;".&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Into the &lt;strong&gt;Edit new file&lt;/strong&gt; textarea, cut and paste the following:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Eleventy Build&lt;/span&gt;

&lt;span class="c1"&gt;# Controls when the action will run. Triggers the workflow on push or pull request&lt;/span&gt;
&lt;span class="c1"&gt;# events but only for the master branch&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;master&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# A workflow run is made up of one or more jobs that can run sequentially or in parallel&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# This workflow contains a single job called "build"&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# The type of runner that the job will run on&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

    &lt;span class="c1"&gt;# Steps represent a sequence of tasks that will be executed as part of the job&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&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;Setup Node.js environment&lt;/span&gt;
      &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-node@v1.4.1&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;Install packages&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm ci&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;Run npm build&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm run build&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;Deploy to gh-pages&lt;/span&gt;
      &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;peaceiris/actions-gh-pages@v3&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;deploy_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.ACTIONS_DEPLOY_KEY }}&lt;/span&gt;
        &lt;span class="na"&gt;publish_dir&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./_site&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tap the &lt;strong&gt;Start commit&lt;/strong&gt; button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Complete the &lt;strong&gt;Commit new file&lt;/strong&gt; form and select &lt;strong&gt;Commit directly to the &lt;code&gt;master&lt;/code&gt; branch&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The workflow script should be fairly self-descriptive. See that &lt;code&gt;${{ secrets.ACTIONS_DEPLOY_KEY }}&lt;/code&gt; line near the end of the workflow? We need to add deploy keys to GitHub before attempting a deployment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set up deployment keys
&lt;/h3&gt;

&lt;p&gt;The following instructions were cribbed from a third-party &lt;a href="https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-create-ssh-deploy-key"&gt;GitHub Actions for GitHub Pages&lt;/a&gt; page. Please check that site for updates before proceeding as these instructions may have changed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Generate a SSH key locally to use as your deploy key.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git config user.email&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; gh-pages &lt;span class="nt"&gt;-N&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;span class="c"&gt;# You will get 2 files:&lt;/span&gt;
&lt;span class="c"&gt;#   gh-pages.pub (public key)&lt;/span&gt;
&lt;span class="c"&gt;#   gh-pages     (private key)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open a browser to your repo and select the &lt;strong&gt;Settings&lt;/strong&gt; tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select &lt;strong&gt;Deploy keys&lt;/strong&gt; from the left menu.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tap the &lt;strong&gt;Add deploy key&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Title&lt;/strong&gt; field, enter "&lt;code&gt;Public key of ACTIONS_DEPLOY_KEY&lt;/code&gt;".&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Key&lt;/strong&gt; field, cut and paste the contents of your &lt;code&gt;gh-pages.pub&lt;/code&gt; SSH key file made in step 1 above.&lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;Allow write access&lt;/strong&gt; box.&lt;/li&gt;
&lt;li&gt;Tap the &lt;strong&gt;Add key&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Select &lt;strong&gt;Secrets&lt;/strong&gt; from the left menu.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tap the &lt;strong&gt;Add a new secret&lt;/strong&gt; link.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Name&lt;/strong&gt; field, enter "&lt;code&gt;ACTIONS_DEPLOY_KEY&lt;/code&gt;".&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Value&lt;/strong&gt; field, cut and paste the contents of your &lt;code&gt;gh-pages&lt;/code&gt; SSH key file from step 1 above.&lt;/li&gt;
&lt;li&gt;Tap the &lt;strong&gt;Add secret&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;IMPORTANT: Delete the local &lt;code&gt;gh-pages&lt;/code&gt; keys at this point. You certainly do not want to add them to your version control (for all to see).&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To initiate a deployment, commit/merge to the &lt;code&gt;master&lt;/code&gt; branch. The first deploy will fail (because the &lt;code&gt;gh-pages&lt;/code&gt; branch has not been created yet).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Go back to the &lt;strong&gt;Settings&lt;/strong&gt; tab.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;GitHub Pages&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;From the &lt;strong&gt;Source&lt;/strong&gt; options, select &lt;code&gt;gh-pages branch&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge some more code into &lt;code&gt;master&lt;/code&gt; to initiate another deploy.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Congrats. You're done! From here on out, you should be able to trigger a fresh build and deploy by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;working/saving locally, committing, and pushing to &lt;code&gt;origin master&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;editing your code at github.com and saving to &lt;code&gt;master&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your updates will deploy to live in mere seconds. All of this takes place within the ecosystem that you version your code in. There are no additional dependencies, no additional accounts, nada. How cool is that?&lt;/p&gt;

&lt;h2&gt;
  
  
  The custom domain
&lt;/h2&gt;

&lt;p&gt;GitHub provides &lt;a href="https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites"&gt;default user sites&lt;/a&gt; that may suit you just fine. If, however, you want to use a custom domain, there's a bit more work involved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set up a custom domain
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If you haven't already set up an apex domain (e.g., &lt;code&gt;example.com&lt;/code&gt;) for this repo, then you will need to add it. Follow the &lt;a href="https://help.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site"&gt;GitHub instructions for managing a custom domain&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;CNAME&lt;/code&gt; file created when you entered your domain in the &lt;strong&gt;Custom domain&lt;/strong&gt; field (above) needs to be included in our distribution directory.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;gh-pages&lt;/code&gt; branch and copy the &lt;code&gt;CNAME&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Go back to the &lt;code&gt;master&lt;/code&gt; branch and add that &lt;code&gt;CNAME&lt;/code&gt; file to the source directory (in this case, the root directory).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;code&gt;.eleventy.js&lt;/code&gt; config file and add the CNAME file to the list of pass-through copies.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;..&lt;/span&gt;
  &lt;span class="nx"&gt;eleventyConfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addPassthroughCopy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CNAME&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;/li&gt;
&lt;li&gt;&lt;p&gt;Save, commit, and push to origin.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;For 12 years, GitHub teased us with a web hosting product that almost did everything we needed. We were grateful and we made due. Along the way, we came up with hacks and workarounds, employing one or more outside services to complete the task. But nothing quite combined source code versioning, flexible site generation, and web hosting in one elegant package.&lt;/p&gt;

&lt;p&gt;With Eleventy and GitHub Actions, we now have it all.&lt;/p&gt;

</description>
      <category>eleventy</category>
      <category>11ty</category>
      <category>githubactions</category>
      <category>githubpages</category>
    </item>
  </channel>
</rss>
