Skip to content

Commit

Permalink
Added new post
Browse files Browse the repository at this point in the history
  • Loading branch information
eli32-vlc committed Apr 16, 2024
1 parent aad997a commit 88c31ee
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 13 deletions.
116 changes: 115 additions & 1 deletion content/posts/How To Build A Simple Website With Hugo.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,119 @@
+++
title = 'How To Build A Simple Website With Hugo'
date = 2024-04-16T13:02:04+10:00
draft = true
draft = false
+++

### Introduction

In this blog post, I'll demonstrate how to construct a basic website using Hugo. For those unfamiliar, Hugo is a static site generator written in Go, known for its speed and user-friendliness. It's versatile enough to create anything from straightforward blogs to intricate websites. As an example, this very blog post you're reading is crafted using Hugo with the Paper theme.

### Prerequisites

Before we dive in, ensure you have the following:

- Command line access
- A text editor like VS Code or Sublime Text
- Git installed on your computer

### Step 1: Install Hugo

First, you'll need to install Hugo using a package manager like Brew or Apt.

##### macOS

```shell
brew install hugo
```

##### Ubuntu/Debian

```shell
sudo apt install hugo
```

### Step 2: Choose A Theme

Head over to the Hugo website and select a theme. Opt for one with comprehensive documentation and preferably dark mode support. For this demonstration, I'll use the Gokarna theme.

### Step 3: Create A New Site

#### Initialize a new site with the following command:

```shell
hugo new site sitename
```

#### Navigate to the new site directory:

```shell
cd sitename
```

### Step 4: Setup Git

Git setup is essential for deploying your website to GitHub and utilizing themes.

#### Initialize a new Git repository:

```shell
git init
```

### Step 5: Add A Theme

Refer to the official documentation of your chosen theme and follow the instructions to integrate it into your website, usually done as a Git submodule.

#### Add the theme as a Git submodule:

```shell
git submodule add https://github.com/526avijitgupta/gokarna.git themes/gokarna
```

> Ensure you replace the Git command with the one specified in the theme's documentation.
### Step 6: Setup Hugo

First, open the folder in a text/code editor and locate the config.toml file. You'll find something like this:

![config.toml](https://i.ibb.co/TmvVfMx/Xnip2024-04-16-18-37-35.jpg)

Begin by adjusting your site title. Then, add the theme by including the following line:

```toml
theme = "gokarna"
```

> Replace "gokarna" with the name of your theme.
#### Start the Hugo server:

```shell
hugo server -D
```

Open the URL displayed in the terminal to view your website.

Now, customize your website following the theme documentation. Since every site is unique, I can't provide exact customization instructions, but you can always seek assistance in the theme's GitHub repository.

### Step 7: Add Content (optional)

Assuming you're using this website for blogging purposes, follow these steps. To add a new blog post, create a new folder in the content directory called "posts." Then, create a new Markdown file with the post's name. Insert the following text into the file:

```markdown
+++
title = 'Title'
date = 2024-04-15T13:02:04+10:00
draft = false
+++
```

> Replace "Title" with your post's title and adjust the date accordingly. You can also change "draft" to true if you don't wish to publish the post yet.
Next, add your content below the front matter. You can utilize Markdown to format your content.

### Step 8: Deploy Your Website

Once satisfied with your website, deploy it to GitHub. Begin by creating a new repository on GitHub, then push your website to the repository. GitHub provides guidance on committing and pushing your code to the repository when you first create it. After pushing your website to GitHub, enable GitHub Actions with the Hugo template. Proceed to your repository settings and enable GitHub Pages, selecting GitHub Actions. Allow a few minutes for the website to deploy.

Thank you for reading! I hope you found this blog post helpful. Best of luck with your website!
2 changes: 1 addition & 1 deletion public/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link>https://blog.eason.fr.to/posts/random-word-api/</link>
<pubDate>Mon, 15 Apr 2024 13:02:04 +1000</pubDate>
<guid>https://blog.eason.fr.to/posts/random-word-api/</guid>
<description>I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:&#xA;http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.&#xA;Please don&amp;rsquo;t spam the api, it&amp;rsquo;s hosted on a free server.</description>
<description>I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:&#xA;http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.&#xA;Please don&amp;rsquo;t spam the api, it&amp;rsquo;s hosted on a free server. More server will be added soon.</description>
</item>
<item>
<title>Effortlessly Manage Docker With Portainer: A Step by Step Guide</title>
Expand Down
2 changes: 1 addition & 1 deletion public/posts/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link>https://blog.eason.fr.to/posts/random-word-api/</link>
<pubDate>Mon, 15 Apr 2024 13:02:04 +1000</pubDate>
<guid>https://blog.eason.fr.to/posts/random-word-api/</guid>
<description>I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:&#xA;http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.&#xA;Please don&amp;rsquo;t spam the api, it&amp;rsquo;s hosted on a free server.</description>
<description>I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:&#xA;http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.&#xA;Please don&amp;rsquo;t spam the api, it&amp;rsquo;s hosted on a free server. More server will be added soon.</description>
</item>
<item>
<title>Effortlessly Manage Docker With Portainer: A Step by Step Guide</title>
Expand Down
13 changes: 7 additions & 6 deletions public/posts/random-word-api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

<meta name="description" content="I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:
http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server." />
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server. More server will be added soon." />
<meta name="author" content="Eason Li" />


Expand Down Expand Up @@ -128,15 +128,15 @@
<meta itemprop="name" content="Random Word API">
<meta itemprop="description" content="I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:
http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server."><meta itemprop="datePublished" content="2024-04-15T13:02:04+10:00" />
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server. More server will be added soon."><meta itemprop="datePublished" content="2024-04-15T13:02:04+10:00" />
<meta itemprop="dateModified" content="2024-04-15T13:02:04+10:00" />
<meta itemprop="wordCount" content="49">
<meta itemprop="wordCount" content="55">
<meta itemprop="keywords" content="" />

<meta property="og:title" content="Random Word API" />
<meta property="og:description" content="I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:
http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server." />
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server. More server will be added soon." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://blog.eason.fr.to/posts/random-word-api/" /><meta property="article:section" content="posts" />
<meta property="article:published_time" content="2024-04-15T13:02:04+10:00" />
Expand All @@ -146,7 +146,7 @@
<meta name="twitter:card" content="summary"/><meta name="twitter:title" content="Random Word API"/>
<meta name="twitter:description" content="I created a simple random word api that will generate a random word upon request. To use this, send a GET request to this url:
http://easapi.pythonanywhere.com/api?api_key=Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX This URL inculdes the api key and no other configuration is needed.
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server."/>
Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server. More server will be added soon."/>



Expand Down Expand Up @@ -286,7 +286,8 @@ <h1 class="!my-0 pb-2.5">Random Word API</h1>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>http://easapi.pythonanywhere.com/api?api_key<span style="color:#f92672">=</span>Il3KG8LWRwtJ2bMFWT3bpvlMZS1vitJf8LhT95AIRtLDj6CkHLmQm7nnOorUWaqn7ASABJVtDpOsCAsKpZNtRVo3exppbpL99x5cstbYugMmK0FyUBJNjePULoty7YiX
</span></span></code></pre></div><p>This URL inculdes the api key and no other configuration is needed.</p>
<blockquote>
<p>Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server.</p>
<p>Please don&rsquo;t spam the api, it&rsquo;s hosted on a free server.
More server will be added soon.</p>
</blockquote>
</section>

Expand Down
8 changes: 4 additions & 4 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://blog.eason.fr.to/</loc>
<lastmod>2024-04-15T13:02:04+10:00</lastmod>
</url><url>
<loc>https://blog.eason.fr.to/posts/how-i-created-a-simple-python-api-for-generating-random-word/</loc>
<lastmod>2024-04-15T13:02:04+10:00</lastmod>
<lastmod>2024-04-16T13:02:04+10:00</lastmod>
</url><url>
<loc>https://blog.eason.fr.to/posts/</loc>
<lastmod>2024-04-16T13:02:04+10:00</lastmod>
</url><url>
<loc>https://blog.eason.fr.to/posts/how-i-created-a-simple-python-api-for-generating-random-word/</loc>
<lastmod>2024-04-15T13:02:04+10:00</lastmod>
</url><url>
<loc>https://blog.eason.fr.to/posts/random-word-api/</loc>
Expand Down

0 comments on commit 88c31ee

Please sign in to comment.