- HTML 46.5%
- CSS 43.4%
- JavaScript 10.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| archetypes | ||
| assets | ||
| i18n | ||
| layouts | ||
| .gitignore | ||
| go.mod | ||
| hugo.toml | ||
| README.md | ||
| theme.toml | ||
OpenCommit Hugo theme
A reusable Hugo theme in the look and feel of opencommit.eu (the Forgejo-based platform that gives open source a free home), maintained by the OpenCommit Foundation.
Powers blog.opencommit.eu for example.
Features
- OpenCommit colour palette, light & dark modes (follows system preference with a manual toggle)
- Blog home, list, single-post, taxonomy, author and 404 layouts
- Client-side search (JSON index) and related posts
- Breadcrumbs, table of contents, share links, prev/next navigation, RSS feeds
- SEO: meta description, Open Graph, Twitter cards, JSON-LD structured data
- Configurable footer menu groups and header call-to-action
- Posts section is configurable (
postsSection) so the theme also works for news/sections with a different name
Requirements
- Hugo extended, v0.128.0 or newer
Installation
Hugo Modules (recommended)
The theme is published as a Hugo module, so the modern way to use it is via Go modules:
hugo mod init example.com/my-site
hugo mod get opencommit.eu/opencommit/oc-hugo-theme
Then add it to your site config:
[module]
[[module.imports]]
path = "opencommit.eu/opencommit/oc-hugo-theme"
The module resolves straight from the Forgejo repository (no Go proxy required). To pin a specific version,
tag a release in the theme repo and run hugo mod get opencommit.eu/opencommit/oc-hugo-theme@v0.1.0. For
reproducible builds, run hugo mod vendor and commit the _vendor/ directory.
To update: hugo mod get -u opencommit.eu/opencommit/oc-hugo-theme.
Classic install
Alternatively, clone the repository into your site's themes directory and add theme = "opencommit" to your site config:
git clone https://opencommit.eu/opencommit/oc-hugo-theme.git themes/opencommit
Quick start
baseURL = "https://example.org/"
languageCode = "en"
title = "My site"
[module]
[[module.imports]]
path = "opencommit.eu/opencommit/oc-hugo-theme"
# Enable the JSON home output used by the built-in search.
# (Theme defaults only guarantee HTML + RSS on the home page.)
[outputs]
home = ["HTML", "RSS", "JSON"]
Configuration
All settings are optional; the theme ships sensible defaults.
| Param | Default | Description |
|---|---|---|
params.author |
"OpenCommit Foundation" |
Site-wide author name |
params.description |
"" |
Site-wide meta description |
params.tagline |
"Build. Push. Deploy." |
Shown next to the logo |
params.logo |
"img/logo.svg" |
Logo asset inside the theme's assets directory |
params.postsSection |
"posts" |
Section the home page and search index list |
params.social.rss |
true |
Show RSS link in footer |
params.social.forge |
"https://opencommit.eu" |
Forge link in footer |
params.social.mail |
"" |
E-mail link in footer |
params.social.mastodon |
"" |
Mastodon profile URL in footer |
params.header.cta.label |
"Donate" |
Header call-to-action label |
params.header.cta.url |
"" |
Header call-to-action URL (hidden when empty) |
params.footer.about |
"" |
Footer "about" text |
params.footer.note |
"EU non-profit · Open source" |
Small footer note |
params.footer.groups |
three groups | Footer link groups (title + menu name) |
Menus
main: top navigationfooter_foundation,footer_platform,footer_legal: default footer groups (names are configurable viaparams.footer.groups)
External menu entries render an external-link marker. Set [menus.<menu>.params] target = "_blank" to open in a
new tab, and noExternalMarker = true to hide the marker.
i18n
The theme ships en.toml. Add translations for the languages you publish in; add other locale files under i18n/ in your site or the theme.
Example
A working example site lives in the blog repository at opencommit.eu/opencommit/blog
(it is built with this theme). To verify the theme locally, build a site with a few content files and run:
hugo server --themesDir ../.. --theme opencommit
When developing the theme against a local clone, point the module import at the local directory:
HUGO_MODULE_REPLACEMENTS="opencommit.eu/opencommit/oc-hugo-theme => /path/to/oc-hugo-theme" hugo server
Logo
assets/img/logo.svg is the official OpenCommit Foundation artwork. It is included for use with OpenCommit-related sites;
treat it as property of the OpenCommit Foundation.
License & Copyright
This theme is created and maintained by the OpenCommit Foundation. All code and images are copyrighted by the foundation.
The theme may be re-used under strict condition that it is not used to impersonate an official OpenCommit Foundation related site.