translations: [ es/Español ] · [ fr/Français ] · [ de/Deutsch ]
Table of contents
Hugo is a popular static site generator (SSG) that simplifies building websites. Here’s a minimal guide on using Hugo:
Installation
Download Hugo: Visit the Hugo releases page and download the appropriate version for your operating system.
Install Hugo: Follow the installation instructions for your OS. For example, on Linux, extract the downloaded file and move the binary to a directory in your system’s PATH.
Creating a New Site
Initialize Site: Open your terminal and navigate to your desired location. Run
hugo new site <sitename>
to create a new Hugo site.Choose a Theme: Browse Hugo’s themes gallery and pick a theme you like. Add it to your site by following the theme’s installation instructions.
Adding Content
Create Content: Use
hugo new <content-type>/<content-name>.<file-extension>
to generate new content files like posts or pages.Edit Content: Open the content files in a text editor and add your content using Markdown or another supported format.
Customization
Configuration: Customize your site’s configuration by modifying the
config.toml
file in the root directory. Set basic settings like site title, language, and other preferences.Custom Layouts: For advanced customization, create or modify templates in the
layouts
directory to change how your site looks.
Building and Previewing
Build Site: Run
hugo
in the terminal within your site’s directory. Hugo will generate your static site files in thepublic
directory.Preview: Use
hugo server -D
to start a local server and view your site in a web browser athttp://localhost:1313
. The-D
flag includes content marked as a draft.
Deployment
Choose Hosting: Select a hosting provider for your static site. Popular options include Netlify, GitHub Pages, or AWS S3.
Upload Files: Upload the contents of the
public
directory generated by Hugo to your chosen hosting provider to make your site live.
Hugo’s simplicity and speed make it a great choice for creating static websites with ease.
Created on: Dec 29, 2023