Include About/Privacy page content in page description

pull/37/head
Matt Baer 6 years ago
parent be2c7ef86b
commit 77e79acd06
  1. 7
      app.go
  2. 1
      pages/about.tmpl
  3. 1
      pages/privacy.tmpl

@ -20,6 +20,7 @@ import (
"github.com/gorilla/schema" "github.com/gorilla/schema"
"github.com/gorilla/sessions" "github.com/gorilla/sessions"
"github.com/manifoldco/promptui" "github.com/manifoldco/promptui"
"github.com/writeas/go-strip-markdown"
"github.com/writeas/web-core/converter" "github.com/writeas/web-core/converter"
"github.com/writeas/web-core/log" "github.com/writeas/web-core/log"
"github.com/writeas/writefreely/config" "github.com/writeas/writefreely/config"
@ -97,8 +98,9 @@ func handleViewHome(app *app, w http.ResponseWriter, r *http.Request) error {
func handleTemplatedPage(app *app, w http.ResponseWriter, r *http.Request, t *template.Template) error { func handleTemplatedPage(app *app, w http.ResponseWriter, r *http.Request, t *template.Template) error {
p := struct { p := struct {
page.StaticPage page.StaticPage
Content template.HTML Content template.HTML
Updated string PlainContent string
Updated string
AboutStats *InstanceStats AboutStats *InstanceStats
}{ }{
@ -124,6 +126,7 @@ func handleTemplatedPage(app *app, w http.ResponseWriter, r *http.Request, t *te
return err return err
} }
p.Content = template.HTML(applyMarkdown([]byte(c))) p.Content = template.HTML(applyMarkdown([]byte(c)))
p.PlainContent = shortPostDescription(stripmd.Strip(c))
if updated != nil { if updated != nil {
p.Updated = updated.Format("January 2, 2006") p.Updated = updated.Format("January 2, 2006")
} }

@ -1,4 +1,5 @@
{{define "head"}}<title>About {{.SiteName}}</title> {{define "head"}}<title>About {{.SiteName}}</title>
<meta name="description" content="{{.PlainContent}}">
{{end}} {{end}}
{{define "content"}} {{define "content"}}
<div class="content-container snug"> <div class="content-container snug">

@ -1,4 +1,5 @@
{{define "head"}}<title>{{.SiteName}} Privacy Policy</title> {{define "head"}}<title>{{.SiteName}} Privacy Policy</title>
<meta name="description" content="{{.PlainContent}}">
{{end}} {{end}}
{{define "content"}}<div class="content-container snug"> {{define "content"}}<div class="content-container snug">
<h1>Privacy Policy</h1> <h1>Privacy Policy</h1>

Loading…
Cancel
Save