Universal is a clean and stylish website template built with Bootstrap. It stands out with its clean design and elegant typography.
This Hugo theme was ported from Bootstrapious for training and fun. It has a very nice and customizable landing page, a comments system by Disqus, site search by Google, contact forms by Formspree, Google Analytics, and optional widgets for the sidebar.
Go to the directory where you have your Hugo site and run:
$ mkdir themes
$ cd themes
$ git clone https://github.com/devcows/hugo-universal-theme
For more information read the official setup guide of Hugo.
After installing the Universal theme successfully, we recommend you to take a look at the exampleSite directory. You will find a working Hugo site configured with the Universal theme that you can use as a starting point for your site.
First, let’s take a look at the config.toml. It will be useful to learn how to customize your site. Feel free to play around with the settings.
Available translations are in the /i18n directory. You can configure the language modifying the following key.
defaultContentLanguage = "en"
You can change the color of the theme by modifying the following key.
The optional comments system is powered by Disqus. If you want to enable comments, create an account in Disqus and write down your shortname.
disqusShortname = "devcows"
You can disable the comments system by leaving the disqusShortname empty.
You can optionally enable Google Analytics. Type your tracking code in the ``.
googleAnalytics = "UA-XXXXX-X"
Leave the googleAnalytics key empty to disable it.
You can select the logos using the logo and logo_small parameters. The logo_small value will be used when the site is rendered on small screens.
You can optionally create a contact page and include a contact form.
A contact page is just like a regular Hugo page. But it must include the field id with the value contact.
+++title = "Contact"id = "contact"+++
You can enable or disable the Google Maps widget on the contact page by setting params.enableGoogleMaps to true or false in config.toml. Make sure to also provide a valid googleMapsApiKey if you decide to enable the widget – otherwise it likely won’t work. By clicking on the pin, Google Maps opens a route description with the coordinates latitude and longitude. Additionally, you can define the direction if you want to have another destination for the directions or the Google Maps entry of your company. If enableGoogleMaps is set to false on the other hand, the subsequent googleMapsApiKey, latitude, longitude and direction will be ignored.
enableGoogleMaps = true
googleMapsApiKey = "AIzaSyCFhtWLJcE30xOAjcbSFi-0fnoVmQZPb1Y"
latitude = "-12.043333"
longitude = "-77.028333"
direction = "Desamparados Station, Distrito de Lima 15001, Peru"
Since Hugo sites are static, the contact form uses Formspree as a proxy. The form makes a POST request to their servers to send the actual email. Visitors can send up to a 1000 emails each month for free.
To enable the form in the contact page, just type your Formspree email in the config.toml file, and specify whether to use ajax(paid) to send request or plain HTTP POST(free).
Each carousel entry is represented as a YAML file inside data/carousel. Let’s see the customizable.yaml as an example of a carousel entry.
weight: 4title: "Easy to customize"description: >
<li>7 preprepared colour variations.</li>
<li>Easily to change fonts</li>
The weight field determines the position of the entry. title is a text-only field. The description field accepts HTML code. And the image must contain the relative path to the image inside the static directory.
Once the carousel is configured, it must be explicitly enabled in the config.toml file.
enable = true
Features are also defined in the data directory just like the carousel:
The content of the consulting.yaml example feature file looks like this:
weight: 4name: "Consulting"icon: "fas fa-lightbulb"url: ""description: "Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring."
The meaning of the individual YAML keys is as follows:
A means to set the order of multiple features; features with a lower weight are displayed first (left to right, top to bottom)
The title text below the feature icon; Markdown is supported
The CSS class of the feature icon; in this example we have used icons powered by FontAwesome
An optional URL the feature icon should point to; if specified, the icon will become a clickable hyperlink
A short text below the title text to describe the feature; Markdown is supported
Once you have completed your features, enable them in the config.toml file.
You can add as many testimonials files as you want. Be sure you fill in all fields as in the following example.
text: "One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections."name: "John McIntyre"position: "CEO, TransTech"avatar: "img/testimonials/person-1.jpg"
Then, enable it in the configuration file and add a title and subtitle.
enable = truetitle = "Testimonials"subtitle = "We have worked with many clients and we always like to hear they come out from the cooperation happy and satisfied. Have a look what our clients said about us."
This section is used to provide a link to another place. It can be an external site, or a page or post within your Hugo site.
You can enable it in the configuration file.
enable = trueicon = "far fa-file-alt"title = "Do you want to see more?"subtitle = "We have prepared for you more than 40 different HTML pages, including 5 variations of homepage."link_url = "http://your-site.com/more"link_text = "Check other homepages"
The clients section is used to show a list of logos of companies you have collaborated with. The clients are defined in the data directory as YAML files.
The name of the client. image is a relative path to the logo inside the static directory. And url is an optional field in case you want to link the logo to the client’s website.
Then, you can enable the section in the configuration file.
enable = truetitle = "Our Partners"subtitle = "We have proudly collaborated with the following companies."
The recent posts sections shows the four latest published blog posts, with their featured image and a summary. It defaults to show recent posts from all main sections. This is either the section with the most posts or can be set explicitly in the configuration file (see linked docs).
The following HTML metadata can be set for every page. While the default value for some of them can be defined in config.toml, all of these properties can also be set through the respective Hugo front matter variables:
article:section and article:tag are set based on Hugo’s categories and tags taxonomies. Since there can only be one article:section, only the first element of the categories array is used as article:section.
You can set default values for all pages in the config.toml file as below:
defaultKeywords = ["devcows", "hugo", "go"]
defaultDescription = "Site template made by Devcows using Hugo"default_sharing_image = "img/sharing-default.png"facebook_site = "https://www.facebook.com/GolangSociety/"twitter_site = "GoHugoIO"
The resulting HTML will be the following:
<metaname="keywords"content="devcows, hugo, go">
<metaname="description"content="Site template made by Devcows using Hugo">
<metaproperty="og:description"content="Site template made by Devcows using Hugo">
<metaname="twitter:description"content="Site template made by Devcows using Hugo">
You can also override the default values from the config.toml by setting the respective keys in the individual pages front matter. As an example, here’s the front matter from the faq.md file in the exampleSite directory:
title = "FAQ"
description = "Frequently asked questions"
keywords = ["FAQ","How do I","questions","what if"]