Also includes examples of Hugo Features or Functions:
Pagination (internal template)
Hugo built-in menu
Template layouts (type “post” uses a special list template, single template, and a content view)
ge (greater than or equal to)
.Site.Params.mainSections to avoid hard-coding “blog,” etc. [release note]
This theme uses the “Tachyons” CSS library. This will allow you to manipulate the design of the theme by changing class names in HTML without touching the original CSS files. For more information see the Tachyons website.
As a Hugo Module (recommended)
Initiate the hugo module system if you haven’t already:
$ hugo mod init github.com/<your_user>/<your_project>
For more information read the official setup guide of Hugo.
After installing the theme successfully it requires a just a few more steps to get your site running.
The config file
Take a look inside the exampleSite folder of this theme. You’ll find a file called config.toml. To use it, copy the config.toml in the root folder of your Hugo site. Feel free to change the strings in this theme.
You may need to delete the line: themesDir = "../.."
To enable comments, add following to your config file:
DISQUS: disqusShortname = YOURSHORTNAME
commentoEnable = true
Change the hero background
For any page or post you can add a featured image by including the local path in front matter (see content in the exampleSite/content/_readme.md file for examples): featured_image: '/images/gohugo-default-sample-hero-image.jpg'
If you would like to hide the header text on the featured image on a page, set omit_header_text to true. See exampleSite/content/contact.md for an example.
You don’t need an image though. The default background color is black, but you can change the color, by changing the default color class in the config.toml file. Choose a background color from any on the Tachyons library site, and preface it with “bg-”
example: background_color_class = "bg-blue" or background_color_class = "bg-gray"
Activate the contact form
This theme includes a shortcode for a contact form that you can add to any page (there is an example on the contact page in the exampleSite folder). One option is to use formspree.io as proxy to send the actual email. Each month, visitors can send you up to one thousand emails without incurring extra charges. Visit the Formspree site to get the “action” link and add it to your shortcode like this:
n.b. in future versions we will likely separate the typeface and other body classes.
You can override the built-in css by using your own. Just put your own css files in the static directory of your website (the one in the theme directory also works but is not recommended) and modify the custom_css parameter in your config file. The path referenced in the parameter should be relative to the static folder. These css files will be added through the header partial after the built-in css file.
For example, if your css files are static/css/custom.css and static/css/custom2.css then add the following to the config file:
If you add a key of show_reading_time true to either the Config Params, a page or section’s front matter, articles will show the reading time and word count.
Adding Scripts to the Page Head
Some scripts need to be added within the page head. To add your own scripts to the page head, simply insert them into the head-additions.html partial located in the layouts/partials folder.
You can replace the title of your site in the top left corner of each page with your own logo. To do that put your own logo into the static directory of your website, and add the site_logo parameter to the site params in your config file. For example:
site_logo = "img/logo.svg"
In order to see your site in action, run Hugo’s built-in local server.