From ee9392a2ba81f2ded4e0e2ab29063e946b86368e Mon Sep 17 00:00:00 2001 From: Naman Sood Date: Fri, 9 Jul 2021 00:51:03 -0400 Subject: [PATCH] server: crawler bots like descriptions Signed-off-by: Naman Sood --- server.go | 7 ++++--- templates/page.html | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server.go b/server.go index 45ba0aa..d0c8139 100644 --- a/server.go +++ b/server.go @@ -117,9 +117,10 @@ func (s *server) errorInRequest(res http.ResponseWriter, req *http.Request, err log.Printf("ERR %s: %s", req.URL.Path, err) } -func (s *server) createWebPage(title, contents string) (string, error) { +func (s *server) createWebPage(title, subtitle, contents string) (string, error) { ctx := map[string]interface{}{ "title": title, + "subtitle": subtitle, "contents": contents, } return s.templates["page"].Exec(ctx) @@ -131,7 +132,7 @@ func (s *server) postPage(p *Post, res http.ResponseWriter, req *http.Request) { if err != nil { s.errorInRequest(res, req, err) } - page, err := s.createWebPage(p.Metadata.Title, contents) + page, err := s.createWebPage(p.Metadata.Title, p.Metadata.Summary, contents) if err != nil { s.errorInRequest(res, req, err) } @@ -151,7 +152,7 @@ func (s *server) homePage(res http.ResponseWriter, req *http.Request) { posts = posts + summary } - page, err := s.createWebPage("Home", posts) + page, err := s.createWebPage("Home", "Where I infodump in Markdown and nobody can stop me.", posts) if err != nil { s.errorInRequest(res, req, err) diff --git a/templates/page.html b/templates/page.html index b1e9c0b..0d06202 100644 --- a/templates/page.html +++ b/templates/page.html @@ -3,9 +3,11 @@ + +