title substitute if no title set

micropub
Niko Abeler 2 weeks ago
parent ecc12333e1
commit 396b84c9bb
  1. 4
      embed/post-list.html
  2. 8
      renderer_test.go

@ -2,7 +2,9 @@
{{range .}}
<div class="h-entry">
<hgroup>
<h3><a class="u-url" href="{{.UrlPath}}">{{.Title}}</a></h3>
<h3><a class="u-url" href="{{.UrlPath}}">
{{ if .Title }}{{.Title}}{{ else }}Note: {{.Id}}{{ end }}
</a></h3>
<small>
Published:
<time class="dt-published" datetime="{{.Meta.Date}}">

@ -86,6 +86,14 @@ func TestCanRenderIndexPage(t *testing.T) {
assertions.AssertContains(t, result, "testpost2")
}
func TestCanRenderIndexPageNoTitle(t *testing.T) {
user := getTestUser()
post, _ := user.CreateNewPostFull(owl.PostMeta{}, "hi")
result, _ := owl.RenderIndexPage(user)
assertions.AssertContains(t, result, post.Id())
assertions.AssertContains(t, result, "Note: ")
}
func TestIndexPageContainsHFeedContainer(t *testing.T) {
user := getTestUser()
user.CreateNewPost("testpost1", false)

Loading…
Cancel
Save