Hugo Cheatsheet

Table Of Contents

Start work on Hugo

Content creation and editing

Push to Git - one time only commands

Push to Git - each time the website needs to be updated.

Your password is your PAT and NOT your GitHub password.

Pushing to git with username nad PAT is tedious. Use command once:

Themes

Here’s a simple hugo.toml for etch theme.

baseURL = 'https://sanjayregmi.com' languageCode = 'en-us' title = 'Sanjay Regmi'

theme = ’etch’
enableRobotsTXT = true

googleAnalytics = “Your G Tag”

[markup.goldmark.renderer]
unsafe = true

[menu]
[[menu.main]]
identifier =‘our-projects’
name = ‘our-projects’
title = ‘Our Projects’
url = ‘/our-projects’

    [[menu.main]]
    identifier ='posts'
    name = 'posts'
    title ='Posts'
    url = '/posts'

Emoji Support

Google Analytics

Hugo comes with built-in support for Google Analytics. All you need to do is to add googleAnalytics = “Your Google Tag” in hugo.toml (Newer versions of Hugo suggest using hugo.toml instead of config.toml). However, as of April 2024, some themes are not working with the above instructions. So here’s an alternative approach that works. The instructions are for the “Etch” theme and you should be able to adjust it for yours.

Old method - does not work for many themes anymore as of April, 2024

googleAnalytics = “X-XX” where X-XX is the google analytics code for your website.

Insert Table of Content

Insert an image

Insert youtube Video

Add last modified date to posts

Add categories and tags to your posts

🍄

Looking for humanized IT Support? We at Prasna IT are ready to assist! Call us at 778 775 9350 or book a free consultation.


Follow me on Twitter or LinkedIn. Read about what else I do.


Previous Post Next Post