diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-10-24 12:52:38 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-10-24 12:52:38 -0400 |
| commit | 268fcf7e6b671d4959a12111d5abf553bf0a201b (patch) | |
| tree | 6f5c46c9a765478eaae78d66f4b9aefc953bbd1a /page/misc.go | |
| parent | d36b6a55c8fa4400cd39de717443e110e990a8a3 (diff) | |
| download | go-website-268fcf7e6b671d4959a12111d5abf553bf0a201b.tar.gz go-website-268fcf7e6b671d4959a12111d5abf553bf0a201b.tar.xz | |
Redis caching. Linter config and cleanup.
Diffstat (limited to 'page/misc.go')
| -rw-r--r-- | page/misc.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/page/misc.go b/page/misc.go index 0dbd059..e8bdfb7 100644 --- a/page/misc.go +++ b/page/misc.go @@ -6,6 +6,8 @@ import ( "gopkg.in/yaml.v3" ) +// EncodeYaml is meant to be used in templating functions to encode +// arbitrary information as a yaml string. func (p Page) EncodeYaml(data interface{}) string { if data == nil { data = p @@ -15,10 +17,13 @@ func (p Page) EncodeYaml(data interface{}) string { if err != nil { Logger.Println("Encountered error in EncodeYaml: ", err) } + return string(b) } -func (p Page) EncodeJson(data interface{}) string { +// EncodeJSON is meant to be used in templating functions to encode +// arbitrary information as a JSON string. +func (p Page) EncodeJSON(data interface{}) string { if data == nil { data = p } @@ -27,5 +32,6 @@ func (p Page) EncodeJson(data interface{}) string { if err != nil { Logger.Println("Encountered error in EncodeJson: ", err) } + return string(b) } |
