From 904e37a88a6a2eab3919f7f2c40bbb2c07544a7c Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Mon, 12 Jul 2021 23:08:58 -0400 Subject: Add atom feed to the go website --- page/page.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'page/page.go') 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) +} -- cgit v1.2.3