Getting Started

2020-10-19
4 min read

In Getting Started you will learn how to quickly build a Hugo site with Eureka.

Prerequisites

To use Eureka normally, you need to install the following:

Installation

Eureka can be quickly integrated into the Hugo project. Currently, Eureka can be installed in two ways: Git Submodule and Hugo Modules.

Install with Git Submodule

If you have or are willing to install Go 1.12 or above in the current environment, you can use the more convenient and quick Hugo Modules installation.

When installing with Git Submodule, you only need to execute under the project location:

git submodule add https://github.com/wangchucheng/hugo-eureka.git themes/eureka

The default content at this time is the main branch. We recommend to use versions in Releases, as the main branch may contain unstable features or even errors. To checkout versions, you only need to:

cd themes/eureka
git checkout <eureka_version>

Next, copy the config folder in exampleSite to the project root directory, and check the contents of the config folder and configure it. After configuration, delete the original config.toml file.

If you create a new Hugo project, the content folder is blank in default. You can copy the content folder in exampleSite to the project root directory to preview.

After completing the above steps, use the following command to preview the project in the browser:

hugo server

Drafts will not be deployed by Hugo, so you need to set the draft property of the content header to false or use hugo server -D to preview the site.

If you are not familiar with the basic usage of Hugo or want to know more about Hugo, you can refer to Hugo Basic Usage.

Install with Hugo Modules

When using Hugo Modules to install Eureka, you need Go 1.12 and above. It is recommended that all users who meet the dependency requirements use this method to install.

First, initialize a new Hugo Module in the project root directory:

hugo mod init <module_name>

Next, copy the config folder in exampleSite to the project root directory, and check the contents of the config folder and configure it.

Finally, comment theme: eureka in config/_default/config.yaml and uncomment theme: github.com/wangchucheng/hugo-eureka. After configuration, delete the original config.toml file.

If you create a new Hugo project, the content folder is blank in default. You can copy the content folder in exampleSite to the project root directory to preview.

After completing the above steps, use the following command to preview the project in the browser:

hugo server

Drafts will not be deployed by Hugo, so you need to set the draft property of the content header to false or use hugo server -D to preview the website.

If you are not familiar with the basic usage of Hugo or want to know more about Hugo, you can refer to Hugo Basic Usage.

Add Content

After installing Eureka, you can start adding content to the website. You can manually create files and add information in the content folder. At the same time, you can also use hugo new to complete the above content for you.

Add a default type of content to the project:

hugo new posts/hello-world.md

This will help you generate a file with the following content in the content/post folder.

---
title: Hello World
description:
toc: true
authors: []
tags: []
categories: []
series: []
date: '2020-10-20T10:30:48+08:00'
lastmod: '2020-10-20T10:30:48+08:00'
featuredImage: ''
draft: false
---

You can modify the value or start writing your body content after the +++ at the end of the file.

Eureka also provides you with other types of templates, you can specify the type with -k KIND:

hugo new -k authors authors/new-author

This will generate author-type content in the content/authors folder.

For all content types provided by Eureka, please refer to archetypes.

Change Configuration

Since Eureka is committed to providing a highly customizable and feature-rich theme, we replaced the automatically generated config.toml file with the config folder to provide a clearer structure. You can modify any content in the configuration file:

title: My Own Title

For the relevant configuration of the homepage, please refer to Homepage Configuration

Generate Site

To generate a site, you need to:

hugo

Similar to hugo server, hugo will not generate draft content. The generated web page is located in the public folder. You can deploy it on static web deployment platforms such as Github Pages or Netlify.


Please Star Eureka if you like it! Star