diff options
| author | Mitchell Riedstra <mitch@x230.my.domain> | 2021-07-11 11:55:47 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@x230.my.domain> | 2021-07-11 11:55:47 -0400 |
| commit | 1c6c1f1597b71f4d4f3a1722655b8864c0d33e6d (patch) | |
| tree | 023701c9d033269d83be8415809b292ae1f3cee0 /page/page.go | |
| parent | e6d53f71c9718ecdb9fde16a924d75a71aadd2d2 (diff) | |
| download | go-website-1c6c1f1597b71f4d4f3a1722655b8864c0d33e6d.tar.gz go-website-1c6c1f1597b71f4d4f3a1722655b8864c0d33e6d.tar.xz | |
Initial banging away at adding an Atom feed to the site
Diffstat (limited to 'page/page.go')
| -rw-r--r-- | page/page.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/page/page.go b/page/page.go index 82f46f2..ecd2268 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 @@ -209,3 +212,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) +} |
