<?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 Pages on Arto&#39;s dev time by-products</title>
    <link>https://artosalminen.github.io/series/github-pages/</link>
    <description>Recent content in GitHub Pages on Arto&#39;s dev time by-products</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Fri, 03 Feb 2023 15:04:11 +0200</lastBuildDate><atom:link href="https://artosalminen.github.io/series/github-pages/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How to set up a blog with Hugo and GitHub Pages in 10 minutes</title>
      <link>https://artosalminen.github.io/posts/how-to-set-up-hugo-blog-in-github-pages/</link>
      <pubDate>Fri, 03 Feb 2023 15:04:11 +0200</pubDate>
      
      <guid>https://artosalminen.github.io/posts/how-to-set-up-hugo-blog-in-github-pages/</guid>
      <description>&lt;p&gt;So you want to set up a blog. Here is how to do it in 10 minutes or less. For me, it took a little more time, just to make sure for you it would not. And actually, even for me, most of the time was used to write this post.&lt;/p&gt;
&lt;p&gt;So here we go, you have 40 for each step.&lt;/p&gt;
&lt;ol start=&#34;0&#34;&gt;
&lt;li&gt;Create GitHub account if you do not have one yet&lt;/li&gt;
&lt;li&gt;Create new GitHub repository named &lt;code&gt;&amp;lt;your GitHub username&amp;gt;.github.io&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;On your local development environment, create a folder to work in, run &lt;code&gt;npm install hugo-bin --save-dev&lt;/code&gt; to install Hugo CLI&lt;/li&gt;
&lt;li&gt;Clone your GitHub repository under the same directory &lt;code&gt;git clone https://github.com/&amp;lt;your username&amp;gt;/&amp;lt;your username&amp;gt;.github.io.git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npx hugo new site &amp;lt;your username&amp;gt;.github.io&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Navigate to the repository root directory &lt;code&gt;cd &amp;lt;your username&amp;gt;.github.io&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add a theme as Git Submodule: &lt;code&gt;git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Update &lt;code&gt;config.toml&lt;/code&gt; by adding the &lt;code&gt;theme = &#39;PaperMod&#39;&lt;/code&gt; option (and add a name for the site while at it)&lt;/li&gt;
&lt;li&gt;Also update &lt;code&gt;config.toml&lt;/code&gt; with your own baseUrl, e.g. &lt;code&gt;baseURL = &#39;https://&amp;lt;your GitHub username&amp;gt;.github.io/&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npx hugo new posts/initial-post.md&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Edit the initial post and when ready to publish, remove the draft tag&lt;/li&gt;
&lt;li&gt;Add the following into &lt;code&gt;.github\workflows\gh-pages.yml&lt;/code&gt; file in the repository
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;name: github pages

on:
push:
    branches:
    - main  # Set a branch that will trigger a deployment
pull_request:

jobs:
    deploy:
        runs-on: ubuntu-22.04
        steps:
        - uses: actions/checkout@v3
            with:
            submodules: true  # Fetch Hugo themes (true OR recursive)
            fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

        - name: Setup Hugo
            uses: peaceiris/actions-hugo@v2
            with:
            hugo-version: &amp;#39;latest&amp;#39;
            # extended: true

        - name: Build
            run: hugo --minify

        - name: Deploy
            uses: peaceiris/actions-gh-pages@v3
            if: github.ref == &amp;#39;refs/heads/main&amp;#39;
            with:
            github_token: ${{ secrets.GITHUB_TOKEN }}
            publish_dir: ./public
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Create a branch named &lt;code&gt;gh-pages&lt;/code&gt; in GitHub&lt;/li&gt;
&lt;li&gt;Check which branch is used for GitHub pages publishing in your GitHub repository, set it to &lt;code&gt;gh-pages&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Set in &lt;strong&gt;GitHub Settings &amp;gt; Actions &amp;gt; General&lt;/strong&gt;: Workflow permissions to &lt;code&gt;Read and write permissions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Push to Git remote using the main branch&lt;/li&gt;
&lt;li&gt;Make sure the deployment went smoothly, and enjoy the result in &lt;code&gt;https://&amp;lt;your GitHub username&amp;gt;.github.io&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
    </item>
    
  </channel>
</rss>
