Hugo theme to create vanity import paths / URLs for "go get" or "import".
See the codeThe govanity Hugo theme simplifies building and maintaining a vanity base domain such as go.example.com or example.dev and serving the required <meta> tags for vanity import paths.
The generated static site can be deployed on any static-capable host. The landing page lists all modules; each module is a content file with fitting front matter. See archetypes/default.md for a ready-to-use template.
By default, Go imports point to repository hosts, e.g.:
import "github.com/user-or-org/foo"
Vanity import paths decouple the import path from the code host. For example, the module hugo-theme-dev can be imported as:
import "golang.foundata.com/hugo-theme-dev"
Under the hood, the site serves <meta name="go-import" ...> that redirect tooling to the real repository (e.g. GitHub).
Further reading, references:
go docs: Remote import pathsClone the repository and run the included example content (requires Hugo, Go, and Git):
git clone https://github.com/foundata/hugo-theme-govanity.git
cd ./hugo-theme-govanity/exampleSite
HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
Or look at the following pages using this theme:
Add the following module path(s) to your theme: configuration:
theme:
- "golang.foundata.com/hugo-theme-govanity"
Hugo automatically fetches and import theme module paths as Go/Hugo modules, so you do not need to list them under module.imports manually. Using modules requires Hugo, Go, and Git to be installed on your system.
From the root directory of your Hugo site, initialize a new Git repository (if you haven't already), then add the theme as a Git submodule:
git submodule add https://github.com/foundata/hugo-theme-govanity.git themes/govanity
Now reference the theme directory name in your theme: configuration:
theme:
- "govanity"
Set your vanity base URL in the Hugo config (this must be the (sub)domain that serves your vanity paths) and disable unsupported page kinds:
baseURL: "https://go.example.com/"
# Single-purpose theme; exact request URIs are critical.
# Disable features that could alter URLs or produce needless pages:
# - Unsupported page kinds
# - Multilingual/i18n (interferes with Go vanity import path matching)
disableKinds:
- "rss"
- "section"
- "taxonomy"
- "term"
defaultContentLanguageInSubdir: false
ℹ️ Heads-up: Exact host + path matters to the Go toolchain. Use HTTPS and avoid extra path segments in
baseURL. Do not forget the trailing slash.
This section documents the theme options you can place under params.theme in your Hugo configuration. The example configurations and are safe to copy-paste. All keys are optional and the theme falls back to sensible behavior unless otherwise noted.
⚠ Easy adaption of colors is not implemented yet (see Issue #6). Coming releases will provide this, stay tuned.
vanityPageTags["go-module"]go-import / go-source meta tags emitted early).tags:.params:
theme:
vanityPageTags:
- "go-module"
- "hugo-module"
---
title: "hugo-theme-dev"
tags:
- "go-module"
- "hugo-module"
repo:
root: "github.com/foundata/hugo-theme-dev"
---
header.logosrc, optional width, optional height.src is a relative path under /assets (e.g., images/logo.svg).width and height become <img> attributes (strings), letting you control layout.params:
theme:
header:
logo:
# This image is shipped with the theme
src: "images/logo-go-gopher-network.svg"
width: "40"
height: "35"
header.showTitletrueheader.title or falls back to .Site.Title.params:
theme:
header:
showTitle: true
header.titleheader.showTitle is true. If empty or unset, the theme uses .Site.Title.params:
theme:
header:
showTitle: true
title: "Go import path overview"
footer.additionalText""params:
theme:
footer:
additionalText: "© 2025 AMCE Inc. | [Contact Us](https://exmaple.com/contact)"
footer.additionalTextTrailingBreaktrueadditionalText.additionalText with attribution toggles below.params:
theme:
footer:
additionalText: "© 2025 AMCE Inc. | [Contact Us](https://exmaple.com/contact)"
additionalTextTrailingBreak: true # will add a <br> after the additional text
footer.showThemeInfotrueparams:
theme:
footer:
showThemeInfo: true
footer.showTrademarksInfotrueparams:
theme:
footer:
showTrademarksInfo: true
footer.showGoGopherInfotrueparams:
theme:
footer:
showGoGopherInfo: true
Add a new Markdown file directly under the content root for each module (no nested folders). For example:
content/hugo-theme-dev.md
You can use the provided archetype to scaffold the front matter:
hugo new hugo-theme-dev.md
# or explicitly: hugo new --kind default hugo-theme-dev.md
Below is the minimal set you'll typically use (see archetypes/default.md for the full, annotated version):
---
title: "hugo-theme-dev"
tags:
- "go-module"
- "hugo-module"
repo:
root: "github.com/foundata/hugo-theme-dev"
---
The theme emits <meta name="go-import"> (and optionally <meta name="go-source">) very early in the page <head> as recommended by Go's docs. The single package page also shows helpful commands and links for humans.
This is a static site: deploy anywhere you can host static files (e.g. your small VM, GitHub Pages, Netlify, Cloudflare Pages, S3 + CDN). Ensure:
baseURL host (e.g., https://go.example.com/).https://go.example.com/hugo-theme-dev?go-get=1 return HTML that includes the go-import meta tag.<head> (the theme already places it first).no go-import meta tags: Verify the request path and that the HTML contains the correct <meta name="go-import" ...> tag. Try visiting the page with ?go-get=1.tags and params.handleTags.go clean -modcache) and ensure DNS/HTTPS and exact paths are correct.This project is compatible with Hugo (extended) ≥ v0.148.0 and should always work with the latest Hugo release (we usually run the latest Hugo ourselves and fix issues promptly). It has been tested at least with:
If your version isn't listed, it might still work. Just give it a try.
See CONTRIBUTING.md if you want to get involved.
This projects's functionality is mature, so there might be little activity on the repository in the future. Don't get fooled by this, the project is under active maintenance and used daily by the maintainers.
Copyright (c) 2025 foundata GmbH (https://foundata.com)
This project is licensed under the GNU General Public License v3.0 or later (SPDX-License-Identifier: GPL-3.0-or-later), see LICENSES/GPL-3.0-or-later.txt for the full text.
The REUSE.toml file provides detailed licensing and copyright information in a human- and machine-readable format. This includes parts that may be subject to different licensing or usage terms, such as third-party components. The repository conforms to the REUSE specification. You can use reuse spdx to create a SPDX software bill of materials (SBOM).
This project was created and is maintained by foundata.
51 commits
1 commits
HTML
81.1%
JavaScript
13.8%
CSS
5.2%
Hugo theme to create vanity import paths / URLs for "go get" or "import".
See the codeThe govanity Hugo theme simplifies building and maintaining a vanity base domain such as go.example.com or example.dev and serving the required <meta> tags for vanity import paths.
The generated static site can be deployed on any static-capable host. The landing page lists all modules; each module is a content file with fitting front matter. See archetypes/default.md for a ready-to-use template.
By default, Go imports point to repository hosts, e.g.:
import "github.com/user-or-org/foo"
Vanity import paths decouple the import path from the code host. For example, the module hugo-theme-dev can be imported as:
import "golang.foundata.com/hugo-theme-dev"
Under the hood, the site serves <meta name="go-import" ...> that redirect tooling to the real repository (e.g. GitHub).
Further reading, references:
go docs: Remote import pathsClone the repository and run the included example content (requires Hugo, Go, and Git):
git clone https://github.com/foundata/hugo-theme-govanity.git
cd ./hugo-theme-govanity/exampleSite
HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
Or look at the following pages using this theme:
Add the following module path(s) to your theme: configuration:
theme:
- "golang.foundata.com/hugo-theme-govanity"
Hugo automatically fetches and import theme module paths as Go/Hugo modules, so you do not need to list them under module.imports manually. Using modules requires Hugo, Go, and Git to be installed on your system.
From the root directory of your Hugo site, initialize a new Git repository (if you haven't already), then add the theme as a Git submodule:
git submodule add https://github.com/foundata/hugo-theme-govanity.git themes/govanity
Now reference the theme directory name in your theme: configuration:
theme:
- "govanity"
Set your vanity base URL in the Hugo config (this must be the (sub)domain that serves your vanity paths) and disable unsupported page kinds:
baseURL: "https://go.example.com/"
# Single-purpose theme; exact request URIs are critical.
# Disable features that could alter URLs or produce needless pages:
# - Unsupported page kinds
# - Multilingual/i18n (interferes with Go vanity import path matching)
disableKinds:
- "rss"
- "section"
- "taxonomy"
- "term"
defaultContentLanguageInSubdir: false
ℹ️ Heads-up: Exact host + path matters to the Go toolchain. Use HTTPS and avoid extra path segments in
baseURL. Do not forget the trailing slash.
This section documents the theme options you can place under params.theme in your Hugo configuration. The example configurations and are safe to copy-paste. All keys are optional and the theme falls back to sensible behavior unless otherwise noted.
⚠ Easy adaption of colors is not implemented yet (see Issue #6). Coming releases will provide this, stay tuned.
vanityPageTags["go-module"]go-import / go-source meta tags emitted early).tags:.params:
theme:
vanityPageTags:
- "go-module"
- "hugo-module"
---
title: "hugo-theme-dev"
tags:
- "go-module"
- "hugo-module"
repo:
root: "github.com/foundata/hugo-theme-dev"
---
header.logosrc, optional width, optional height.src is a relative path under /assets (e.g., images/logo.svg).width and height become <img> attributes (strings), letting you control layout.params:
theme:
header:
logo:
# This image is shipped with the theme
src: "images/logo-go-gopher-network.svg"
width: "40"
height: "35"
header.showTitletrueheader.title or falls back to .Site.Title.params:
theme:
header:
showTitle: true
header.titleheader.showTitle is true. If empty or unset, the theme uses .Site.Title.params:
theme:
header:
showTitle: true
title: "Go import path overview"
footer.additionalText""params:
theme:
footer:
additionalText: "© 2025 AMCE Inc. | [Contact Us](https://exmaple.com/contact)"
footer.additionalTextTrailingBreaktrueadditionalText.additionalText with attribution toggles below.params:
theme:
footer:
additionalText: "© 2025 AMCE Inc. | [Contact Us](https://exmaple.com/contact)"
additionalTextTrailingBreak: true # will add a <br> after the additional text
footer.showThemeInfotrueparams:
theme:
footer:
showThemeInfo: true
footer.showTrademarksInfotrueparams:
theme:
footer:
showTrademarksInfo: true
footer.showGoGopherInfotrueparams:
theme:
footer:
showGoGopherInfo: true
Add a new Markdown file directly under the content root for each module (no nested folders). For example:
content/hugo-theme-dev.md
You can use the provided archetype to scaffold the front matter:
hugo new hugo-theme-dev.md
# or explicitly: hugo new --kind default hugo-theme-dev.md
Below is the minimal set you'll typically use (see archetypes/default.md for the full, annotated version):
---
title: "hugo-theme-dev"
tags:
- "go-module"
- "hugo-module"
repo:
root: "github.com/foundata/hugo-theme-dev"
---
The theme emits <meta name="go-import"> (and optionally <meta name="go-source">) very early in the page <head> as recommended by Go's docs. The single package page also shows helpful commands and links for humans.
This is a static site: deploy anywhere you can host static files (e.g. your small VM, GitHub Pages, Netlify, Cloudflare Pages, S3 + CDN). Ensure:
baseURL host (e.g., https://go.example.com/).https://go.example.com/hugo-theme-dev?go-get=1 return HTML that includes the go-import meta tag.<head> (the theme already places it first).no go-import meta tags: Verify the request path and that the HTML contains the correct <meta name="go-import" ...> tag. Try visiting the page with ?go-get=1.tags and params.handleTags.go clean -modcache) and ensure DNS/HTTPS and exact paths are correct.This project is compatible with Hugo (extended) ≥ v0.148.0 and should always work with the latest Hugo release (we usually run the latest Hugo ourselves and fix issues promptly). It has been tested at least with:
If your version isn't listed, it might still work. Just give it a try.
See CONTRIBUTING.md if you want to get involved.
This projects's functionality is mature, so there might be little activity on the repository in the future. Don't get fooled by this, the project is under active maintenance and used daily by the maintainers.
Copyright (c) 2025 foundata GmbH (https://foundata.com)
This project is licensed under the GNU General Public License v3.0 or later (SPDX-License-Identifier: GPL-3.0-or-later), see LICENSES/GPL-3.0-or-later.txt for the full text.
The REUSE.toml file provides detailed licensing and copyright information in a human- and machine-readable format. This includes parts that may be subject to different licensing or usage terms, such as third-party components. The repository conforms to the REUSE specification. You can use reuse spdx to create a SPDX software bill of materials (SBOM).
This project was created and is maintained by foundata.
51 commits
1 commits
HTML
81.1%
JavaScript
13.8%
CSS
5.2%