<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Github on Rich's Blog</title><link>https://richlin-blog.pages.dev/tags/github/</link><description>Recent content in Github on Rich's Blog</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Fri, 11 Aug 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://richlin-blog.pages.dev/tags/github/index.xml" rel="self" type="application/rss+xml"/><item><title>How to create a blog using Github Pages and Hugo in 10 minutes</title><link>https://richlin-blog.pages.dev/posts/230811_create_new_blog/</link><pubDate>Fri, 11 Aug 2023 00:00:00 +0000</pubDate><guid>https://richlin-blog.pages.dev/posts/230811_create_new_blog/</guid><description>&lt;p&gt;Ah, the age-old tradition of starting a blog. Whether you&amp;rsquo;re doing it to share your favorite cat photos, write about your ever-so-exciting daily life, or discuss something actually serious, you&amp;rsquo;re in luck!&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s dive into the realm of Hugo and GitHub to create a blog that even your grandma would be proud to share on Facebook.&lt;/p&gt;
&lt;h1 id="initial-setup"&gt;Initial setup&lt;/h1&gt;
&lt;h3 id="step-1-set-up-2-github-repos-like-a-pro"&gt;Step 1: Set up 2 Github repos like a Pro&lt;/h3&gt;
&lt;p&gt;Why one when you can have two? That&amp;rsquo;s right, folks!&lt;/p&gt;</description><content:encoded><![CDATA[<p>Ah, the age-old tradition of starting a blog. Whether you&rsquo;re doing it to share your favorite cat photos, write about your ever-so-exciting daily life, or discuss something actually serious, you&rsquo;re in luck!</p>
<p>Let&rsquo;s dive into the realm of Hugo and GitHub to create a blog that even your grandma would be proud to share on Facebook.</p>
<h1 id="initial-setup">Initial setup</h1>
<h3 id="step-1-set-up-2-github-repos-like-a-pro">Step 1: Set up 2 Github repos like a Pro</h3>
<p>Why one when you can have two? That&rsquo;s right, folks!</p>
<ul>
<li><strong>test_blog</strong>: Where blogs and dreams live.</li>
<li><strong>test_site.github.io</strong>: Sounds techy, right? It&rsquo;s the repo for showing off! One trhing to remember, it has to come with the suffix <code>github.io</code> in order to be published in Github properly.</li>
</ul>
<p>And clone both repos to your local, because we will need to edit.</p>
<h3 id="step-2-install-hugo-not-the-boss">Step 2: Install Hugo (Not the Boss)</h3>
<p>Sorry, not the fashion brand.</p>
<p>Hugo is a static site generator that simplifies the creation of websites. Installing it on your system is the first step in creating your new site.</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew install hugo</span></span></code></pre></div><h3 id="step-3-create-a-hugo-site-no-nnot-a-dating-profile">Step 3: Create a Hugo site (No, Nnot a dating profile)</h3>
<p>Time to initialize our blog love child. Naming it <code>blog</code> (Because we&rsquo;re creative like THAT) inside the first repo.</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="nb">cd</span> test_blog
</span></span><span class="line"><span class="cl">hugo new site blog </span></span></code></pre></div><h4 id="step-4-add-themes-or-how-to-dress-your-blog">Step 4: Add themes (Or how to dress your blog)</h4>
<p>Let&rsquo;s beautify your blog with the <strong>PaperMod</strong> theme, one of the many themes Hugo offers.<br>
<strong>Note</strong>: you can find detailed installation guide here: <a href="https://github.com/adityatelange/hugo-PaperMod/wiki/Installation">https://github.com/adityatelange/hugo-PaperMod/wiki/Installation</a></p>
<ul>
<li><strong>Install</strong>: Because copying others&rsquo; fashion sense is fine online!</li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperMod --depth<span class="o">=</span><span class="m">1</span></span></span></code></pre></div><ul>
<li><strong>Edit</strong>: Here&rsquo;s where you make it your own without breaking anything (hopefully). All the themes are configured in <code>hugo.yaml</code> or <code>hugo.toml</code>file. There are a lot of things you can config, below are the most important ones. You can add copy all other configs from theme page: <a href="https://github.com/adityatelange/hugo-PaperMod/wiki/Installation#sample-configyml">https://github.com/adityatelange/hugo-PaperMod/wiki/Installation#sample-configyml</a></li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">baseURL</span><span class="p">:</span><span class="w"> </span><span class="s1">&#39;https://test_site.github.io/&#39;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">languageCode</span><span class="p">:</span><span class="w"> </span><span class="s1">&#39;en-us&#39;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">theme</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;PaperMod&#34;</span></span></span></code></pre></div><h3 id="step-5-create-the-first-blog-the-hello-world-of-your-social-life">Step 5: Create the first blog (The &ldquo;Hello, World!&rdquo; of your social life)</h3>
<p>This will create the first blog post in the folder</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">hugo new posts/test.md </span></span></code></pre></div><h3 id="step-6-test-website-yes-you-have-to-test-it">Step 6: Test website (Yes, you have to test it)</h3>
<p>Preview your masterpiece:</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">hugo server</span></span></code></pre></div><h3 id="step-7-connect-2-repos-because-they-should-talk">Step 7: Connect 2 repos (because they should talk)</h3>
<p>Get these repos connected. It&rsquo;s like setting up a playdate, but for code.</p>
<ul>
<li>Move to the test_site.github.io repo, edit readme file, and push to Github. You will need to have 1 commit for this to work properly.</li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> test_site.github.io
</span></span><span class="line"><span class="cl">git add .
</span></span><span class="line"><span class="cl">git commit -m <span class="s1">&#39;inital commit&#39;</span>
</span></span><span class="line"><span class="cl">git push</span></span></code></pre></div><ul>
<li>Then move back to the location where you</li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> ..
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> test_blog<span class="se">\b</span>log
</span></span><span class="line"><span class="cl">git submodule add -b main https://github.com/xxxxx/test_site.github.io.git public </span></span></code></pre></div><h3 id="step-8-final-testing-because-once-wasnt-enough">Step 8: Final Testing (Because Once Wasn&rsquo;t Enough)</h3>
<p>Double-check, triple-check, and then generate!</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">hugo server</span></span></code></pre></div><p>Generate static files. This command will automatically generate a lot of files inside <code>public</code> folder.</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">hugo -t PaperMod
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> public 
</span></span><span class="line"><span class="cl">git add .
</span></span><span class="line"><span class="cl">git commit -m <span class="s1">&#39;generate static files&#39;</span>
</span></span><span class="line"><span class="cl">git push origin main</span></span></code></pre></div><p><strong>Now, all local work are done.</strong></p>
<h3 id="step-9-publish-the-website-in-github">Step 9: Publish the website in Github</h3>
<p>Now go to the repo within Github, find <code>settings &gt; pages</code>, and voila! Your webpage is now hanging out at <strong>test_site.github.io</strong>.</p>
<h3 id="step-10-you-did-it-probably">Step 10: You Did It! (Probably)</h3>
<p>Congrats on your new blog! Now go out there and blog like no one&rsquo;s reading (because let&rsquo;s be honest, it might take a while before they do).</p>
<p>Happy blogging, you absolute legend!</p>
<h1 id="publish-a-new-post">Publish a new post</h1>
<h3 id="step-1-write-a-blog-post-or-a-novel-whos-judging">Step 1: Write a blog post (Or a novel, who&rsquo;s judging?)</h3>
<p>Look at you, the next Shakespeare of the blogging world!</p>
<ul>
<li><strong>Create the Post</strong>: There are 2 ways to do this, you can choose either one
<ul>
<li>
<ol>
<li>Simply create an MD file under the <code>/content/posts/</code> folder.</li>
</ol>
</li>
<li>
<ol start="2">
<li>Use Hugo to create. It&rsquo;s like magic, but geekier.</li>
</ol>
</li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">hugo new --kind post posts/test.md </span></span></code></pre></div></li>
<li><strong>Push Draft Versions</strong>: Feel like saving your progress? Do it just like you&rsquo;re writing code because, well, you are.</li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git add .
</span></span><span class="line"><span class="cl">git commit 
</span></span><span class="line"><span class="cl">git push</span></span></code></pre></div><p>&ldquo;<em>Commit early, commit often,</em>&rdquo; they say. Who are &ldquo;they&rdquo;? No idea, but they seem to know their stuff.</p>
<h3 id="step-2-publish-the-blog-cue-fanfare-">Step 2: Publish the Blog (Cue fanfare 🎺)</h3>
<p>Finished your magnum opus? Excellent! Let&rsquo;s turn those words into webpages.</p>
<ul>
<li><strong>Generate Static Files</strong>: The public folder isn&rsquo;t going to update itself (if only, right?). Time to give it some fresh content.</li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">hugo -t PaperMod</span></span></code></pre></div><ul>
<li><strong>Publish with Hugo</strong>: Feel that? That&rsquo;s the rush of publishing! Let&rsquo;s wrap this up with a snazzy sequence of commands.</li>
</ul>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> public 
</span></span><span class="line"><span class="cl">git add .
</span></span><span class="line"><span class="cl">git commit -m <span class="s1">&#39;add blog&#39;</span>
</span></span><span class="line"><span class="cl">git push origin main</span></span></code></pre></div><h3 id="conclusion-you-did-it-again">Conclusion: You Did It (Again)!</h3>
<p>Behold your blog post, live and in pixels! You&rsquo;ve written, you&rsquo;ve coded, you&rsquo;ve conquered. Go on, share it with the world, or at least with your cat. Either way, congrats on being absolutely blog-tastic!</p>
<p>Fin. No, really, you can stop reading now.</p>
<h1 id="reference">Reference</h1>
<ul>
<li><a href="https://www.youtube.com/watch?v=LIFvgrRxdt4">A great step by step Youtube guide by Ryan Schachte</a></li>
<li><a href="https://themes.gohugo.io/">Hugo themes</a></li>
<li><a href="https://adityatelange.github.io/hugo-PaperMod/posts/papermod/papermod-installation/">Hugo set up</a></li>
<li><a href="https://www.markdownguide.org/basic-syntax/">Markdown basics</a></li>
<li><a href="https://pages.github.com/">Github Pages</a></li>
<li><a href="https://www.youtube.com/watch?v=sm3IuE7zkYQ&amp;list=PLeiDFxcsdhUrzkK5Jg9IZyiTsIMvXxKZP&amp;index=3">Another Youtube guide to build website with Hugo</a></li>
<li><a href="https://ashish.one/blogs/build-developer-profile/">Some other useful inforation about setting up Hugo website</a></li>
</ul>
]]></content:encoded></item></channel></rss>