Can't figure out the 'Last Modified' with Github commit link

I’m using the Docsy theme.

I have enabled enableGitInfo = true and added my github_repo in the config.toml file.

I also have the lastmod: field in frontmatter.

I have a layout/partial file with:

{{ if and (.GitInfo) (.Site.Params.github_repo) -}}
<div class="text-muted mt-5 pt-3 border-top">
  {{ T "post_last_mod" }} {{ .Lastmod.Format .Site.Params.time_format_default -}}
  {{ with .GitInfo }}: {{/* Trim WS */ -}}
    <a href="{{ $.Site.Params.github_repo }}/commit/{{ .Hash }}">
      {{- .Subject }} ({{ .AbbreviatedHash }}) {{- /* Trim WS */ -}}
  {{- end }}
{{ end -}}

I tried adding this partial in my single.html file with no luck.

I want the ‘Last modified on .Date with Github commit link’ at the bottom of every page.

I tested your partial with:

github_repo = ''
time_format_default = 'Jan 1, 2006 3:04:05 PM'

And I called like this (notice the dot):

{{ partial "lastmod.html" . }}

And it works as expected.

Thanks, I got it figured out with your help here and from another one of your posts. Ultimately, I realized I had put the github_repo under [params.ui] instead of [params]

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.