diff options
Diffstat (limited to 'docs/content/en/functions/base64.md')
-rw-r--r-- | docs/content/en/functions/base64.md | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/docs/content/en/functions/base64.md b/docs/content/en/functions/base64.md deleted file mode 100644 index a6de64bd9..000000000 --- a/docs/content/en/functions/base64.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: base64 -description: "`base64Encode` and `base64Decode` let you easily decode content with a base64 encoding and vice versa through pipes." -categories: [functions] -menu: - docs: - parent: functions -keywords: [] -relatedfuncs: [] -signature: ["base64Decode INPUT", "base64Encode INPUT"] ---- - -```go-html-template -{{ "Hugo" | base64Encode }} → "SHVnbw==" -{{ "SHVnbw==" | base64Decode }} → "Hugo" -``` - -## `base64` with APIs - -Using base64 to decode and encode becomes really powerful if we have to handle -responses from APIs. - -```go-html-template -{{ $resp := getJSON "https://api.github.com/repos/gohugoio/hugo/readme" }} -{{ $resp.content | base64Decode | markdownify }} -``` - -The response of the GitHub API contains the base64-encoded version of the [README.md](https://github.com/gohugoio/hugo/blob/master/README.md) in the Hugo repository. Now we can decode it and parse the Markdown. The final output will look similar to the rendered version on GitHub. |