Hugo module to create a unified activity heatmap from multiple sources
Find a file
2026-05-15 09:19:33 -04:00
assets/js Update levels to make heatmap look nicer 2026-05-13 07:33:47 -04:00
get_history Change default location for activity.json 2026-05-15 06:32:47 -04:00
img Update README 2026-05-15 09:19:33 -04:00
layouts Update heatmap with legend and extra color level 2026-05-13 07:20:41 -04:00
.gitignore Add gitlab to provides 2026-05-13 23:12:19 -04:00
hugo.toml Add tooltip and create hugo shortcode 2026-05-11 22:07:28 -04:00
README.md Update README 2026-05-15 09:19:33 -04:00

Hugo Unified Git Activity

Example heatmap generated

Maintain bathroom tile developer status when working in multiple git hubs.

This repo provides:

  1. A Go command (at ./get_history) that fetches git activity from Github, Gitlab, and Forgejo
  2. A Hugo partial and shortcode that generates a git styled heatmap from it

Dependencies

  • Go
  • Hugo

User Guide

Running activity collection

To run the go script to get activity history you can just do

go run forge.alexselimov.com/aselimov/hugo-unified-git-activity/get_history@latest -o /path/to/hugo/static

This requires the following environment variables to be defined:

GH_API_KEY=
FJ_API_KEY=
FJ_USER=
FJ_URL=
GL_API_KEY= //Optional default to gitlab.com
GL_USER=
GL_URL=

Environment variables can be placed in a .env script wherever you are running the go command from. If you don't define environment variables, it will just skip that hub. Example, if any FJ_* variable is undefined then the forgejo portion will be skipped.

Hugo shortcode

First add this module to your hugo.toml

# edit hugo.toml
[module]
[[module.imports]]
path = 'forge.alexselimov.com/aselimov/hugo-unified-git-activity'

Then run hugo mod get -u to pull the latest version. You should now be able to add the heatmap to your site using either a shortcode in the markdown, e.g.

{{< git-heatmap >}}

or as a partial to your html templates:

{{ partial "git-heatmap.html" . }}

Keeping activity in-sync

I host my site (and some other self-hosted stuff) on a Vultr vps. To keep my activity in sync, I just set up a cron job that does:

*/30 * * * * go run forge.alexselimov.com/aselimov/hugo-unified-git-activity/get_history@latest -o /var/www/alexselimov.com/activity.json

If you aren't on a VPS and using actions to deploy your site (That's how I deploy my personal blog), you can just add an action to update your static/activity.json and deploy however often you want.

Important Notes

  • I originally wrote it in Typescript but thought go would be better to distribute to Hugo users (since you probably already have go installed) so the go version is a completely vibed port. I didn't look at the code, but it's probably fine? I did verify it's not sending credentials anywhere at least haha.
  • Private repo contributions are tracked, but they are anonymized in the activity.json. It shows up as "private": "<count>".
  • I added Gitlab functionality but I don't use Gitlab so it may have issues. I set up a test account and did a quick test to make sure a new commit showed up, but good likelihood of edge cases.