.GitInfo out of scope in shortcode

I’ve added on github an attempt for a page for latest changes on the Hugo documentation via a shortcode. Works fine.

But when I try to add some .GitInfo.xxx, .GitInfo is out of the scope of the shortcode. (OK elsewhere)

I tried to pass some context to the shortcode, but without success. Couldn’t find either a hint on discourse or google. I guess it is go template related but I’m puzzled.

Any hint/tip ?

{{ range first $nombre_md (sort .Site.RegularPages.ByLastmod ".Lastmod" "desc") }}
   {{.Lastmod.Format "Jan, 02 2006"}} => OK
   {{ .Permalink }}" => OK
   {{ .Title }} => OK
   {{ $url }} => OK
   {{ .GitInfo }} => can't succed to have .GitInfo It is <nil>
{{ end }}


Shortcodes have access to parameters delimited in the shortcode declaration via .Get, page- and site-level variables, and also the following shortcode-specific fields

So a shortcode has no access to .File, .Hugo, .Menu, .GitInfo, .Sitemap variables …

I tried to pass some context to the shortcode
You can only pass strings as parameters…

Yes it has, but you must look in the Page context:

1 Like

Thanks for the responses.

Well … I tried that previously, and tried this time again the @bep advice with {{ .Page.GitInfo }} , but still got an error.

executing “shortcodes/latest-updated.html” at <.Site.Page.GitInfo>: can’t evaluate field Page in type *hugolib.SiteInfo