The repository widget shows the commit information about current page, it’s useful for users to view or edit the source code.

Requirements#

This widget relies on the .GitInfo, so you’ll need to either enable it via the --enableGitInfo flag or setting the enableGitInfo as true in config.toml.

1$ hugo --enableGitInfo
1enableGitInfo = true

Site Parameters#

NameTypeDefaultDescription
repoObject-
repo.urlString-Required. The URL of your public repository. GitHub and GitLab are supported.
repo.branchStringmasterThe branch name.
repo.subPathString-The sub path of content.
repo.dateFormatString02/01/2006, 15:04:05 PMThe format of commit date.

Usage#

The repository widget is disabled by default, you’ll need to include widget via Hooks.

For posts layout.

1{{- partial "docs/repo" . }}

For docs layout.

1{{- partial "docs/repo" . }}