Sending Webmentions #10
|
@ -10,9 +10,15 @@
|
|||
<link rel="webmention" href="{{ .User.WebmentionUrl }}">
|
||||
<style>
|
||||
header {
|
||||
background-color: {{.HeaderColor}};
|
||||
background-color: {{.UserConfig.HeaderColor}};
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: dashed 2px;
|
||||
border-color: #ccc;
|
||||
}
|
||||
|
||||
|
||||
hgroup h2 a { color: inherit; }
|
||||
</style>
|
||||
</head>
|
||||
|
@ -23,8 +29,8 @@
|
|||
<ul>
|
||||
<li>
|
||||
<hgroup>
|
||||
<h2><a href="{{ .User.UrlPath }}">{{ .UserTitle }}</a></h2>
|
||||
<h3>{{ .UserSubtitle }}</h3>
|
||||
<h2><a href="{{ .User.UrlPath }}">{{ .UserConfig.Title }}</a></h2>
|
||||
<h3>{{ .UserConfig.SubTitle }}</h3>
|
||||
</hgroup>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -35,6 +41,13 @@
|
|||
{{ .Content }}
|
||||
</main>
|
||||
<footer class="container">
|
||||
<nav>
|
||||
<ul>
|
||||
{{ if .UserConfig.TwitterHandle}}
|
||||
<li><a href="https://twitter.com/{{.UserConfig.TwitterHandle}}" rel="me">@{{.UserConfig.TwitterHandle}} on Twitter</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -50,16 +50,14 @@ func renderIntoBaseTemplate(user User, data PageContent) (string, error) {
|
|||
Title string
|
||||
Content template.HTML
|
||||
User User
|
||||
UserTitle string
|
||||
UserConfig UserConfig
|
||||
UserSubtitle string
|
||||
HeaderColor string
|
||||
}{
|
||||
Title: data.Title,
|
||||
Content: data.Content,
|
||||
User: user,
|
||||
UserTitle: user_config.Title,
|
||||
UserSubtitle: user_config.SubTitle,
|
||||
HeaderColor: user_config.HeaderColor,
|
||||
UserConfig: user_config,
|
||||
}
|
||||
|
||||
var html bytes.Buffer
|
||||
|
|
|
@ -25,6 +25,25 @@ func TestCanRenderPost(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func TestRenderTwitterHandle(t *testing.T) {
|
||||
user := getTestUser()
|
||||
config, _ := user.Config()
|
||||
config.TwitterHandle = "testhandle"
|
||||
user.SetConfig(config)
|
||||
post, _ := user.CreateNewPost("testpost")
|
||||
result, err := owl.RenderPost(&post)
|
||||
|
||||
if err != nil {
|
||||
t.Error("Error rendering post: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if !strings.Contains(result, "href=\"https://twitter.com/testhandle\" rel=\"me\"") {
|
||||
t.Error("Twitter handle not rendered. Got: " + result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestRenderPostHEntry(t *testing.T) {
|
||||
user := getTestUser()
|
||||
post, _ := user.CreateNewPost("testpost")
|
||||
|
|
Loading…
Reference in New Issue