A very basic Hugo theme, with bare-boned layouts and no CSS.
Go to file
Kevin C. Coram 5f24758cbd
Fix instructions
2020-01-04 16:41:43 -05:00
archetypes (chore) Initial commit 2019-11-19 00:17:00 -05:00
exampleSite Add mainSections definition; set pagination to 5 2019-11-24 16:32:16 -05:00
layouts Add a menu link back to the home page 2019-11-24 21:39:29 -05:00
LICENSE.md (chore) Initial commit 2019-11-19 00:17:00 -05:00
README.md Fix instructions 2020-01-04 16:41:43 -05:00
theme.toml Downgrade min version to 0.54.0 2019-11-20 22:26:59 -05:00


A Basic Hugo Theme

While the official documentation about Hugo Templates does provide all of the pieces to get started creating a theme, it doesn't necessarily put them together in one, easy-to-see-together place. This theme attempts to pull all of the necessary pieces together into a theme that can be used as a starting point to create more sophisticated themes.

Getting Started

Follow the Hugo Quickstart instructions on how to install Hugo, create a site, and install a theme. Installing the theme as a git submodule is the preferred way.

git submodule add https://git.thecorams.net/kevin/basic-theme.git themes/basic-theme

Example Site

The theme includes an example site to give a quick way to see how the theme looks and behaves.

cd exampleSite
hugo serve [ -D ] --themesDir ../..

Most of the sample posts are intentionally set draft: true to allow for testing few posts vs many posts.


As a very basic theme, there is very little to be configured via the config.toml file.

The footer layout file uses Hugo's markdownify pipe to display the copyright configuration setting, providing support both for HTML character escape sequences such as © as well as markdwn formatting and links.

Note: Hugo versions 0.60.0 and up will have restrictions on using embedded HTML, including escape secquences, unless the Goldmark renderer is configure with unsafe = true.

subtitle parameter

Setting the subtitle parameter adds a secondary header underneath the title in the site header.

  subtitle = "A sub-title for your site"

mainSections parameter

Setting the mainSections parameter restricts the pages that appear on the homepage.

  mainSections = ["posts"]

Theme Organization

Semantic Content Organization

The chrome of the theme page organization is as follows:

    <title>Site Title</title>
          <h1>Site Title</h1>
          <h2>Site Sub-title</h2>
            <!-- Site Navigation/Menu: links to pages that are part of -->
            <!-- the "main" menu                                       -->
            <h1>Content Title</h1>
                <!-- Content Navigation/Menu: a place holder for a       -->
                <!-- content specific menu, such as a list of blog posts -->
                <!-- based on publication date. Not yet implemented.     -->
            <!-- The page content. For list sections, this is where the  -->
            <!-- the list of pages goes. For single pages, this is where -->
            <!-- the content of the page markdown file goes.             -->
            <!-- The page footer. For list sections, this is where the   -->
            <!-- pagination controls can go. For single pages, this is   -->
            <!-- where auther attribution and/or prev/next page controls -->
            <!-- could go.                                               -->
        <!-- The Site Footer, for copyright information etc. -->

If the content pages use ## as their largest heading, this will result in document outlines structured as:

  1. Site Title
    1. Site Sub-title
  2. Content Title
    1. Header from Content
      1. Sub-header from content
    2. Second Header from Content

Hugo Templating

The template layout files make heavy use of Hugo's base and block constructs, as can be seen in baseof.html.


This block is used for generating the <title>....</title> markup for the rendered page and defaults to using the title configuration from comfig.toml. The list and single templates add the page title, to facilitate generating a unique title for every page.


This block is for providing a site banner that will appear at the top of every page, and matches with the primary <header>...</header> definition from the semantic organization, above.

The default site-header block displays the header.html partial.


This block is for providing a site-level navigation, which also appears at the top of every page. It renders in the <nav>...</nav> block within the primary header.

The default site-meny block displays the site-menu partial.


This block is for providing a header for the specific page, matching with the header block inside the <main>....<\main> definition from the semantic organization. The list and single templates display the page title as a <h1>...</h1> level header.


This block is for providing navigation menu(s) for the main content, matching with the <nav>...</nav> block inside the main header. The block is currently a place holder, with no default implementation.


This block is for the content of the page.

For list pages, the content from the section's _index.md will be rendered, followed by a list of all of the pages within the section, using the summary template.

For single pages, the page content will be rendered inside an <article>...</article> block element.

This block provides a footer for the page, which renders within the <footer></footer> block at the end of the <main></main> section.

The default content-footer blocks for the homepage and for list pages implement pagination controls to show the content summaries a page at a time.

The default content-footer block for single pages displays previous and/or next in section links.

This block is for the site footer that appears at the end of every pages.

The default footer block displays the footer.html partial.


HTML5 Semantics