[ TechDocsCove ]  TechDocsCove en   ↩︎

# Gettings started with Hugo static site generator (SSG)

hugo   static site generators  

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

  1. Download Hugo: Visit the Hugo releases page and download the appropriate version for your operating system.

  2. 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

  1. Initialize Site: Open your terminal and navigate to your desired location. Run hugo new site <sitename> to create a new Hugo site.

  2. 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

  1. Create Content: Use hugo new <content-type>/<content-name>.<file-extension> to generate new content files like posts or pages.

  2. Edit Content: Open the content files in a text editor and add your content using Markdown or another supported format.

Customization

  1. 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.

  2. Custom Layouts: For advanced customization, create or modify templates in the layouts directory to change how your site looks.

Building and Previewing

  1. Build Site: Run hugo in the terminal within your site’s directory. Hugo will generate your static site files in the public directory.

  2. Preview: Use hugo server -D to start a local server and view your site in a web browser at http://localhost:1313. The -D flag includes content marked as a draft.

Deployment

  1. Choose Hosting: Select a hosting provider for your static site. Popular options include Netlify, GitHub Pages, or AWS S3.

  2. 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


Email shareIcon for sharing via email    Reddit shareIcon for sharing via Reddit    X shareIcon for sharing via X    Telegram shareIcon for sharing via Telegram    WhatsApp shareIcon for sharing via WhatsApp    Facebook shareIcon for sharing via Facebook    LinkedIn shareIcon for sharing via LinkedIn