add webmention link to base.html
This commit is contained in:
parent
2309dfb0ce
commit
61a5435971
|
@ -7,6 +7,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{{ .Title }}</title>
|
<title>{{ .Title }}</title>
|
||||||
<link rel="stylesheet" href="/static/pico.min.css">
|
<link rel="stylesheet" href="/static/pico.min.css">
|
||||||
|
<link rel="webmention" href="{{ .User.WebmentionUrl }}">
|
||||||
<style>
|
<style>
|
||||||
header {
|
header {
|
||||||
background-color: {{.HeaderColor}};
|
background-color: {{.HeaderColor}};
|
||||||
|
|
|
@ -143,3 +143,17 @@ func TestRendersHeaderTitle(t *testing.T) {
|
||||||
t.Error("Header color not rendered. Got: " + result)
|
t.Error("Header color not rendered. Got: " + result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRenderPostIncludesRelToWebMention(t *testing.T) {
|
||||||
|
user := getTestUser()
|
||||||
|
post, _ := user.CreateNewPost("testpost")
|
||||||
|
|
||||||
|
result, _ := owl.RenderPost(&post)
|
||||||
|
if !strings.Contains(result, "rel=\"webmention\"") {
|
||||||
|
t.Error("webmention rel not rendered. Got: " + result)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !strings.Contains(result, "href=\""+user.WebmentionUrl()+"\"") {
|
||||||
|
t.Error("webmention href not rendered. Got: " + result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
5
user.go
5
user.go
|
@ -36,6 +36,11 @@ func (user User) FullUrl() string {
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (user User) WebmentionUrl() string {
|
||||||
|
url, _ := url.JoinPath(user.FullUrl(), "webmention/")
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
func (user User) PostDir() string {
|
func (user User) PostDir() string {
|
||||||
return path.Join(user.Dir(), "public")
|
return path.Join(user.Dir(), "public")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue