<?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: helena ✨</title>
    <description>The latest articles on DEV Community by helena ✨ (@herrowna).</description>
    <link>https://dev.to/herrowna</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%2F78672%2F24691ead-796a-4171-a314-351988ace7b5.jpg</url>
      <title>DEV Community: helena ✨</title>
      <link>https://dev.to/herrowna</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/herrowna"/>
    <language>en</language>
    <item>
      <title>Using Forestry To Maintain Your Hugo Site on GitHub Pages</title>
      <dc:creator>helena ✨</dc:creator>
      <pubDate>Sun, 02 Dec 2018 14:48:39 +0000</pubDate>
      <link>https://dev.to/herrowna/using-forestry-to-maintain-your-hugo-site-on-github-pages-45n6</link>
      <guid>https://dev.to/herrowna/using-forestry-to-maintain-your-hugo-site-on-github-pages-45n6</guid>
      <description>&lt;p&gt;There's a lot going on here. But let's make this as painless as possible.&lt;/p&gt;

&lt;p&gt;Assumptions: You are using Hugo to generate a static site, which in turn is hosted on GitHub Pages. You then want to maintain future content using &lt;a href="https://forestry.io" rel="noopener noreferrer"&gt;Forestry&lt;/a&gt;, a lightweight and beautiful CMS for Hugo/Jekyll meant for people who prefer to manage their content outside of a terminal. &lt;/p&gt;

&lt;p&gt;Forestry is also free for personal use, which means they're perfect for individual bloggers. On the free tier, you can also collaborate with &lt;a href="https://forestry.io/pricing/" rel="noopener noreferrer"&gt;up to 3 guests&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup GitHub Pages &amp;amp; Hugo
&lt;/h2&gt;

&lt;p&gt;My setup between Hugo and GitHub pages is based on &lt;a href="https://dev.to/dgavlock/creating-a-hugo-site-on-github-pages-3cjo"&gt;this guide&lt;/a&gt; by &lt;a class="mentioned-user" href="https://dev.to/dgavlock"&gt;@dgavlock&lt;/a&gt;, you can use the same guide to setup two seperate repositories that will power your site. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;your-hugo-site&lt;/code&gt;: A repo for the 'backend' of Hugo. You will use this repo to configure your blog settings, add new posts, etc. This will be the repo you connect to Forestry.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;your-user-name&amp;gt;.github.io&lt;/code&gt;: This repo is for static files generated by Hugo. Forestry will deploy the files under &lt;code&gt;public&lt;/code&gt; in the repo above to this one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Create A Site on Forestry
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Let's add a new site. In our case, pick Hugo (make sure you get the version correct. You can check using &lt;code&gt;hugo version&lt;/code&gt; on your terminal):&lt;br&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%2F9gh35rm4hc6uzxczm8io.png" 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%2F9gh35rm4hc6uzxczm8io.png" alt="Pick Your Site Generator" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pick your git provider. Since your page is being hosted on GitHub pages, it'll be GitHub:&lt;br&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%2Fz9q9jom5p8v03ir0llev.png" 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%2Fz9q9jom5p8v03ir0llev.png" alt="Select Your Git Provider" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You'll be directed to GitHub for authentication, then you can pick which repo you would like Forestry to access. Pick the &lt;code&gt;your-hugo-site&lt;/code&gt; repo you just created:&lt;br&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%2Fklnongwxx0r47hbafjxe.png" 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%2Fklnongwxx0r47hbafjxe.png" alt="Pick a repo" width="800" height="453"&gt;&lt;/a&gt;&lt;br&gt;
You'll be prompted to pick a branch, in our case it's &lt;code&gt;master&lt;/code&gt;. If all goes well, Forestry will be able to detect your &lt;code&gt;config.toml&lt;/code&gt; file. If it fails, you'll have to make sure your Hugo site is &lt;a href="https://dev.to/dgavlock/creating-a-hugo-site-on-github-pages-3cjo"&gt;properly set up&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You'll be prompted to invite guests in the last dialog. Feel free to invite collaborators or skip that for now.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And there you go! You have connected your repo to Forestry. You can now access your posts through Forestry's UI.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Configuring Forestry
&lt;/h2&gt;

&lt;p&gt;Once you're in the app, go to &lt;strong&gt;Settings&lt;/strong&gt; to configure your Forestry and make sure it's deploying to the correct place.&lt;/p&gt;

&lt;h3&gt;
  
  
  Under General
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Make sure you enter your &lt;strong&gt;url&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You can also turn on &lt;strong&gt;Deploy on Git Push&lt;/strong&gt; if you fancy (it means pushing to &lt;code&gt;your-hugo-site&lt;/code&gt;, not &lt;code&gt;&amp;lt;your-user-name&amp;gt;.github.io&lt;/code&gt;). This means content will be deployed automatically to  &lt;code&gt;&amp;lt;your-user-name&amp;gt;.github.io&lt;/code&gt; if you push manually from the terminal.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Under Deployment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In &lt;em&gt;Connection&lt;/em&gt;, pick &lt;strong&gt;GitHub Pages&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You'll be prompted to pick a repo from your GitHub account, in this case pick &lt;code&gt;&amp;lt;your-user-name&amp;gt;.github.io&lt;/code&gt;. This will let Forestry deploy Hugo's changes under &lt;code&gt;public/&lt;/code&gt; to this repo.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  If you're using a custom domain (&lt;a href="https://forestry.io/docs/hosting/github-pages/#using-a-custom-domain" rel="noopener noreferrer"&gt;ref&lt;/a&gt;)
&lt;/h4&gt;

&lt;p&gt;Since Forestry overwrites your repo every time it deploys, you'll want to create a CNAME record under the &lt;code&gt;static&lt;/code&gt; folder in &lt;code&gt;your-hugo-site&lt;/code&gt; repo. Hugo will make sure a copy of your CNAME be deployed in the root directory. &lt;/p&gt;

&lt;p&gt;From the root of &lt;code&gt;your-hugo-site&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "your-url-here.com" &amp;gt; static/CNAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, you'll want to push those changes to your remote:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add static/CNAME
git commit -m "Modify custom domain for my site"
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Writing Blog Posts with Forestry
&lt;/h2&gt;

&lt;p&gt;Forestry has a pretty Markdown editor that reminds me of &lt;a href="https://bear.app" rel="noopener noreferrer"&gt;Bear&lt;/a&gt;  writer 🐻 It looks like this:&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%2Fe7pwvki6tjwlqzht927o.png" 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%2Fe7pwvki6tjwlqzht927o.png" alt="Forestry App" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  If You Want To Make Changes To Your Theme
&lt;/h2&gt;

&lt;p&gt;You may want to change your blog's theme from time to time. In order to do that, you'll need to update the files under &lt;code&gt;themes/&lt;/code&gt; in &lt;code&gt;your-hugo-site&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Head to &lt;code&gt;&amp;lt;your-user-name&amp;gt;.github.io&lt;/code&gt; and make sure you've got the latest deploy from Forestry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git pull origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, switch over to &lt;code&gt;your-hugo-site&lt;/code&gt; and modify your theme.&lt;/p&gt;

&lt;p&gt;Once you're done, get Hugo to generate the static files in your &lt;code&gt;&amp;lt;your-user-name&amp;gt;.github.io&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hugo -D ../&amp;lt;your-user-name&amp;gt;.github.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;-D&lt;/code&gt; is a flag that allows you to define the destination for the generated static files.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Switch back to &lt;code&gt;&amp;lt;your-user-name&amp;gt;.github.io&lt;/code&gt; and push the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ../&amp;lt;your-user-name&amp;gt;.github.io
git add .
git commit -m "Update my theme"
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  The End! Happy Writing With Forestry 🦌
&lt;/h1&gt;

</description>
      <category>forestry</category>
      <category>hugo</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
