add u-url to post page
This commit is contained in:
parent
6e6d8005da
commit
945a13ed2f
|
@ -6,6 +6,7 @@
|
||||||
<time class="dt-published" datetime="{{.Post.Meta.Date}}">
|
<time class="dt-published" datetime="{{.Post.Meta.Date}}">
|
||||||
{{.Post.Meta.Date}}
|
{{.Post.Meta.Date}}
|
||||||
</time>
|
</time>
|
||||||
|
<a class="u-url" href="{{.Post.FullUrl}}">#</a>
|
||||||
</small>
|
</small>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
7
post.go
7
post.go
|
@ -358,11 +358,8 @@ func (post *Post) OutgoingWebmentions() []WebmentionOut {
|
||||||
func (post *Post) ScanForLinks() error {
|
func (post *Post) ScanForLinks() error {
|
||||||
// this could be done in markdown parsing, but I don't want to
|
// this could be done in markdown parsing, but I don't want to
|
||||||
// rely on goldmark for this (yet)
|
// rely on goldmark for this (yet)
|
||||||
postHtml, err := renderPostContent(post)
|
postHtml := post.RenderedContent()
|
||||||
if err != nil {
|
links, _ := post.user.repo.Parser.ParseLinks(postHtml.Bytes())
|
||||||
return err
|
|
||||||
}
|
|
||||||
links, _ := post.user.repo.Parser.ParseLinks([]byte(postHtml))
|
|
||||||
for _, link := range links {
|
for _, link := range links {
|
||||||
post.AddOutgoingWebmention(link)
|
post.AddOutgoingWebmention(link)
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,3 +199,17 @@ func TestRenderPostNotMentioningWebmentionsIfNoAvail(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRenderIncludesFullUrl(t *testing.T) {
|
||||||
|
user := getTestUser()
|
||||||
|
post, _ := user.CreateNewPost("testpost")
|
||||||
|
result, _ := owl.RenderPost(&post)
|
||||||
|
|
||||||
|
if !strings.Contains(result, "class=\"u-url\"") {
|
||||||
|
t.Error("u-url not rendered. Got: " + result)
|
||||||
|
}
|
||||||
|
if !strings.Contains(result, post.FullUrl()) {
|
||||||
|
t.Error("Full url not rendered. Got: " + result)
|
||||||
|
t.Error("Expected: " + post.FullUrl())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue