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.

$ hugo --enableGitInfo
enableGitInfo = true

Site Parameters#

Name Type Default Description
repo Object -
repo.url String - Required. The URL of your public repository. GitHub and GitLab are supported.
repo.branch String master The branch name.
repo.subPath String - The sub path of content.
repo.dateFormat String 02/01/2006, 15:04:05 PM The format of commit date.

Usage#

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

For posts layout.

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

For docs layout.

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