Skip to content

johannag126/hugo-serif-theme

 
 

Repository files navigation

Hugo Serif Theme

Serif is a modern business theme for Hugo. It contains content types for the archetypical business website. The theme is fully responsive, blazing fast and artfully illustrated.

Live Demo | Zerostatic Themes

Hugo Serif Theme screenshot

Theme features

Content Types

  • Services (Markdown)
  • Team (Markdown)
  • Features (Data)

CSS

  • SCSS (Hugo Pipelines)
  • Responsive design
  • Bootstrap 4.4 grid and media queries only
  • Uncomment @import 'bootstrap/bootstrap'; in style.scss to use the entire Bootstrap framework

Speed

  • 100/100 Google Lighthouse speed score
  • Under 50KB without images or 80KB with images and illustrations ⚡
  • No jQuery, only a tiny bit of vanilla Javascript for the mobile menu.

SEO

  • 100/100 Google Lighthouse SEO score
  • Google analytics configured in config.toml
  • Configure GID using env variable HUGO_GOOGLE_ANALYTICS_ID, compatible with Netlify.
  • Configure meta tags and OG meta tags for the homepage in config.toml
  • Override any meta tags on a per page basis
  • Semantic HTML document structure

Accessibility

  • 100/100 Google Lighthouse accessibility score
  • Accessible colors, headings and link text (by design)
  • Attention has been paid to using correct contrast, font sizes etc
  • Attention has been paid to ensuring comfortable hit zones and link sizing on mobile

Menu

  • Responsive menu managed in config.toml
  • Animated hamburger menu on mobile

Content

  • Robust example content included
  • Royalty free illustrations included

Templating

  • No hardcoded content in the layouts
  • Plenty of examples of using range and where to loop over various sections/content types
  • Examples of range by Param
  • Examples of using data content (data/contact.yaml and data/features.json)
  • Example of passing .Site . (context) and custom variables to partials - see layouts/page/contact.html - {{ partial "call.html" (dict "site" .Site "context" . "show_button" "false") }}
  • Examples of injecting javascript files on a per page basis (see services/single.html)
  • Set body classes from individual layouts - useful for CSS styling.
  • Example of using Hugo custom layout for the contact page

Hugo Installation

To use this theme you will need to have Hugo installed. If you don't already have Hugo installed please follow the official installation guide

Check Hugo version (Hugo Extended is required!)

This theme uses Hugo Pipes to compile SCSS and minify assets. Please make sure you have the Hugo Extended version installed. If you are not using the extended version this theme will not work.

To check your version of Hugo, run:

hugo version

This will output the currently installed version of Hugo. Make sure you see /extended after the version number, for example Hugo Static Site Generator v0.51/extended darwin/amd64 BuildDate: unknown You do not need to use version v0.51 specifically, it just needs to have the /extended part

Theme Installation

Download, fork or clone this repo, it's ready to go.

hugo
hugo server

Deployment

Stackbit

Use Stackbit to deploy this theme. This theme contains a valid and tested stackbit.yaml

Create with Stackbit

Netlify

Use Netlify to deploy this theme. This theme contains a valid and tested netlify.toml - Feel free to use the 1-click deploy below.

Deploy to Netlify

Configuring Theme

Google Analytics

Copy your Google Analytics ID into the config.toml in the google_analytics_id field - Also supports Google Tag Manager.

# config.toml
[params]
  google_analytics_id = ""
  google_tag_manager_id = ""

When your site is running locally using hugo server the GA tag is not injected. This prevents polluting your real data.

Homepage meta tags

Often a homepage requires special meta tags such as a meta description or og meta data for twitter, facebook etc. You can configure these values in the config.toml

# config.toml
  [params.homepage_meta_tags]
    meta_description = "a description of your website."
    meta_og_title = "My Theme"
    meta_og_type = "website"
    meta_og_url = "https://www.mywebsite.com"
    meta_og_image = "https://www.mywebsite.com/images/tn.png"
    meta_og_description = "a description of your website."
    meta_twitter_card = "summary"
    meta_twitter_site = "@mytwitterhandle"
    meta_twitter_creator = "@mytwitterhandle"

Override meta tags on a per layout basis

You can set meta tags on a per template basis using a block. For example, you might want to write a custom meta description for the /services page. You can insert any valid HTML meta data inside the {{ define "meta_tags }} block at the top of a template.

// layouts/services/list.html

{{ define "meta_tags" }}
    <meta name="description" content="We offer a variety of services in the finance industry" />
{{ end }}

Credits

License

This theme is open source under the MIT license. Please be respectful 🙏🏽

  • If you fork or copy this theme please leave me as an original author in the LICENSE file on line 3 where I am listed as the author.
  • Please don't create ports of this theme without at least asking me. Yes this theme is open-source but I've had several people "port" this theme (with only minor changes) and then advertise the theme as their own. Then they don't update it and it starts to get old and break etc. Now lots of people are finding these old crappy versions of the theme.

About

Serif is a modern business theme for Hugo.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • SCSS 73.7%
  • HTML 25.7%
  • JavaScript 0.6%