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:
parent
b9914dd65a
commit
b336e95e12
2 changed files with 5 additions and 1 deletions
4
posts.go
4
posts.go
|
@ -229,6 +229,10 @@ func (p Post) Summary() string {
|
||||||
return shortPostDescription(p.Content)
|
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.
|
// Excerpt shows any text that comes before a (more) tag.
|
||||||
// TODO: use HTMLExcerpt in templates instead of this method
|
// TODO: use HTMLExcerpt in templates instead of this method
|
||||||
func (p *Post) Excerpt() template.HTML {
|
func (p *Post) Excerpt() template.HTML {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</h4>
|
</h4>
|
||||||
{{if .Summary}}<p>{{.Summary}}</p>{{end}}
|
{{if .Summary}}<p>{{.SummaryHTML}}</p>{{end}}
|
||||||
</div>{{end}}
|
</div>{{end}}
|
||||||
</div>{{ else }}<div id="no-posts-published"><p>You haven't saved any drafts yet.</p>
|
</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>
|
<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>
|
||||||
|
|
Loading…
Add table
Reference in a new issue