encoding.Base64Decode
Returns the base64 decoding of the given content.
Syntax
encoding.Base64Decode INPUT
Returns
string
Alias
base64Decode
{{ "SHVnbw==" | base64Decode }} → HugoUse the base64Decode function to decode responses from APIs. For example, the result of this call to GitHub’s API contains the base64-encoded representation of the repository’s README file:
https://api.github.com/repos/gohugoio/hugo/readmeTo retrieve and render the content:
{{ $url := "https://api.github.com/repos/gohugoio/hugo/readme" }}
{{ with try (resources.GetRemote $url) }}
  {{ with .Err }}
    {{ errorf "%s" . }}
  {{ else with .Value }}
    {{ with . | transform.Unmarshal }}
      {{ .content | base64Decode | markdownify }}
    {{ end }}
  {{ else }}
    {{ errorf "Unable to get remote resource %q" $url }}
  {{ end }}
{{ end }}Last updated:
March 5, 2025
:
content: Remove "related" array from function and method pages (2fcd21ee5)
Improve this page