Back to Falco

Changelog

layouts/shortcodes/changelog.html

latest1.1 KB
Original Source

{{- $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 }}

Download

{{ .body | markdownify }}

{{- $separator = "


" -}} {{- end -}} {{ else }} {{ $.Page.Scratch.Set "github_error" true }} {{ end }}