Render HTML entities in Drafts list

Previously, we'd show the raw HTML entities in the summaries of Draft
posts, instead of rendering them. This fixes that.
This commit is contained in:
Matt Baer 2020-01-20 15:20:45 -05:00
parent b9914dd65a
commit b336e95e12
2 changed files with 5 additions and 1 deletions

View file

@ -229,6 +229,10 @@ func (p Post) Summary() string {
return shortPostDescription(p.Content)
}
func (p Post) SummaryHTML() template.HTML {
return template.HTML(p.Summary())
}
// Excerpt shows any text that comes before a (more) tag.
// TODO: use HTMLExcerpt in templates instead of this method
func (p *Post) Excerpt() template.HTML {

View file

@ -34,7 +34,7 @@
{{end}}
{{ end }}
</h4>
{{if .Summary}}<p>{{.Summary}}</p>{{end}}
{{if .Summary}}<p>{{.SummaryHTML}}</p>{{end}}
</div>{{end}}
</div>{{ else }}<div id="no-posts-published"><p>You haven't saved any drafts yet.</p>
<p>They'll show up here once you do. {{if not .SingleUser}}Find your blog posts from the <a href="/me/c/">Blogs</a> page.{{end}}</p>