aboutsummaryrefslogtreecommitdiff
path: root/page/page.go
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2021-07-12 23:08:58 -0400
committerMitchell Riedstra <mitch@riedstra.dev>2021-07-12 23:18:44 -0400
commit904e37a88a6a2eab3919f7f2c40bbb2c07544a7c (patch)
tree07ec38801bf572a2933d51d272fc4cd3ab74b61c /page/page.go
parente6d53f71c9718ecdb9fde16a924d75a71aadd2d2 (diff)
downloadgo-website-904e37a88a6a2eab3919f7f2c40bbb2c07544a7c.tar.gz
go-website-904e37a88a6a2eab3919f7f2c40bbb2c07544a7c.tar.xz
Add atom feed to the go website
Diffstat (limited to 'page/page.go')
-rw-r--r--page/page.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/page/page.go b/page/page.go
index 82f46f2..8b84099 100644
--- a/page/page.go
+++ b/page/page.go
@@ -25,6 +25,7 @@ package page
import (
"bufio"
"bytes"
+ "encoding/json"
"fmt"
"io"
"log"
@@ -45,6 +46,8 @@ type Page struct {
Title string
Head string
Description string
+ AuthorName string
+ AuthorEmail string
// Tags to apply to the page in question. Useful for Index()
Tags map[string]interface{}
Date *PageTime
@@ -58,10 +61,6 @@ type Page struct {
// .Global care must be taken when utilizing this functionality
var Global interface{}
-// CachePages determines whether or not the rendered page will be stored in
-// memory
-var CachePages = true
-
// CacheIndex determines whether or not the index will be cached in memory
// or rebuilt on each call
var CacheIndex = true
@@ -102,11 +101,6 @@ func (p *Page) Global() interface{} {
return Global
}
-// SetVars Will set to `nil` if provided
-func (p *Page) SetVars(vars map[string]interface{}) {
- p.Vars = vars
-}
-
// Renders a page
func (p *Page) Render(wr io.Writer) error {
if err := p.Read(); err != nil {
@@ -209,3 +203,9 @@ func (p *Page) RenderBody() (string, error) {
func (p Page) String() string {
return fmt.Sprintf("Page: %s", p.path)
}
+
+// StringDetail prints a detailed string of the page
+func (p Page) StringDetail() string {
+ b, _ := json.MarshalIndent(p, "", " ")
+ return fmt.Sprintf("Page: %s\n%s\n", p.path, b)
+}