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:

Quick Installation

Eureka can be quickly installed by using the Github Template Hugo Eureka Starters.

When using this method, please click the Use this template button on the page and set your repository information.

If you want to install with Hugo Modules, just click the Create repository from template button after entering the information.

If you want to install with Git Submodules, please refer to the manual installation of Install with Git Submodules.

Manual Installation

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

Install with Git Submodules

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 Submodules, 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: wangchucheng.com/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

If you encounter error like Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): resource "css/css/eureka.css_09b9b8e200b8c676e85ddca87a9596ca" not found in file cache, please try to update Hugo to 0.100.0 or above.

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