layouts/shortcodes/changelog.html
{{- $releases_url := (.Get 0) -}} {{- $gh_project_repo := ($.Site.Param "github_project_repo") -}} {{- $dataJSON := false }} {{- $headers := dict -}} {{- with $github_token := (os.Getenv "HUGO_GITHUB_TOKEN" | default false ) -}} {{- $headers = dict "Authorization" (printf "Bearer %s" .) -}} {{- end -}} {{- with try (resources.GetRemote $releases_url (dict "headers" $headers)) -}} {{- with .Err -}} {{- errorf "Error fetching GitHub API: %s" . -}} {{- else with .Value -}} {{- $dataJSON = . | transform.Unmarshal -}} {{- end -}} {{- else -}} {{- errorf "Unable to fetch remote resource %q" $releases_url -}} {{- end }} {{ with $dataJSON }}
{{- $separator := false -}} {{- range $release := $dataJSON }} {{- with $separator }} {{/* No separator before the first entry */}} {{ . | markdownify }} {{- end }}
{{ .body | markdownify }}
{{- $separator = "
" -}} {{- end -}} {{ else }} {{ $.Page.Scratch.Set "github_error" true }} {{ end }}