aboutsummaryrefslogtreecommitdiff
path: root/page/page.go
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2021-07-18 16:27:24 -0400
committerMitchell Riedstra <mitch@riedstra.dev>2021-07-18 16:27:24 -0400
commitbcf6d391f17a193c81ad6643f8d006de6c6abad8 (patch)
treeb8eaec45b02d79f8d51d6726ffbbe34ce5de2ed7 /page/page.go
parent904e37a88a6a2eab3919f7f2c40bbb2c07544a7c (diff)
downloadgo-website-0.0.13.tar.gz
go-website-0.0.13.tar.xz
Adjust the program a bit, remove clunky "head" templates. Add an example site among other improvementsv0.0.13
Diffstat (limited to 'page/page.go')
-rw-r--r--page/page.go33
1 files changed, 0 insertions, 33 deletions
diff --git a/page/page.go b/page/page.go
index 8b84099..e984383 100644
--- a/page/page.go
+++ b/page/page.go
@@ -25,7 +25,6 @@ package page
import (
"bufio"
"bytes"
- "encoding/json"
"fmt"
"io"
"log"
@@ -44,7 +43,6 @@ import (
type Page struct {
path string
Title string
- Head string
Description string
AuthorName string
AuthorEmail string
@@ -112,34 +110,9 @@ func (p *Page) Render(wr io.Writer) error {
return err
}
- // Automatically pull from the yml file if applicable
- if p.Head != "" {
- t, err = t.Parse(`
- {{define "head"}}
- {{.RenderHead}}
- {{end}}
- `)
- if err != nil {
- return err
- }
- }
-
return t.Execute(wr, p)
}
-func (p *Page) RenderHead() (string, error) {
- buf := &bytes.Buffer{}
- t, err := template.New("Head").Parse(p.Head)
- if err != nil {
- return "", err
- }
- err = t.Execute(buf, p)
- if err != nil {
- return "", err
- }
- return string(buf.Bytes()), nil
-}
-
// Reads in the special markdown file format for the website off of the disk
func (p *Page) Read() error {
yamlBuf := bytes.NewBuffer(nil)
@@ -203,9 +176,3 @@ 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)
-}