diff --git a/parse.go b/parse.go index b8e0cc4..c080345 100644 --- a/parse.go +++ b/parse.go @@ -55,6 +55,8 @@ func homepageParser(done <-chan struct{}, page *HTMLPage, pc *PageChannel, tmMap } log.Printf("[homepage] Title: %s", title) tf.Title = title + // issue #11 add url to page content + tf.Url = page.URL.String() var pageNum int64 if s := doc.Find("span.red").Eq(1); s.Text() == "" { diff --git a/template.go b/template.go index 292802e..66836bb 100644 --- a/template.go +++ b/template.go @@ -89,9 +89,10 @@ func renderHTML(done <-chan struct{}, tempc <-chan *TemplateField, tmpl *templat err = writeOutput(filename, func(w *bufio.Writer) error { if err := tmpl.Execute(w, struct { Title string + Url string Comments []*OutputField Lzls map[uint64]*LzlComment - }{Title: t.Title, Comments: t.Comments, Lzls: t.Lzls.Map}); err != nil { + }{Title: t.Title, Url: t.Url, Comments: t.Comments, Lzls: t.Lzls.Map}); err != nil { return fmt.Errorf("error executing template %s: %v", filename, err) } return nil diff --git a/template/template1.html b/template/template1.html index 6aea705..ad5d51f 100644 --- a/template/template1.html +++ b/template/template1.html @@ -21,6 +21,9 @@
+