#13 GitHub Handle
This commit is contained in:
parent
ecfcd84b82
commit
a8998068ad
|
@ -76,6 +76,7 @@ var webmentionCmd = &cobra.Command{
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
processPost(user, &post)
|
processPost(user, &post)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
posts, err := user.Posts()
|
posts, err := user.Posts()
|
||||||
|
|
|
@ -44,7 +44,12 @@
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
{{ if .UserConfig.TwitterHandle}}
|
{{ if .UserConfig.TwitterHandle}}
|
||||||
<li><a href="https://twitter.com/{{.UserConfig.TwitterHandle}}" rel="me">@{{.UserConfig.TwitterHandle}} on Twitter</a></li>
|
<li><a href="https://twitter.com/{{.UserConfig.TwitterHandle}}" rel="me">@{{.UserConfig.TwitterHandle}} on Twitter</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .UserConfig.GitHubHandle}}
|
||||||
|
<li><a href="https://github.com/{{.UserConfig.GitHubHandle}}" rel="me">@{{.UserConfig.GitHubHandle}} on GitHub</a>
|
||||||
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -44,6 +44,25 @@ func TestRenderTwitterHandle(t *testing.T) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRenderGitHubHandle(t *testing.T) {
|
||||||
|
user := getTestUser()
|
||||||
|
config, _ := user.Config()
|
||||||
|
config.GitHubHandle = "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://github.com/testhandle\" rel=\"me\"") {
|
||||||
|
t.Error("GitHub handle not rendered. Got: " + result)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func TestRenderPostHEntry(t *testing.T) {
|
func TestRenderPostHEntry(t *testing.T) {
|
||||||
user := getTestUser()
|
user := getTestUser()
|
||||||
post, _ := user.CreateNewPost("testpost")
|
post, _ := user.CreateNewPost("testpost")
|
||||||
|
|
1
user.go
1
user.go
|
@ -22,6 +22,7 @@ type UserConfig struct {
|
||||||
SubTitle string `yaml:"subtitle"`
|
SubTitle string `yaml:"subtitle"`
|
||||||
HeaderColor string `yaml:"header_color"`
|
HeaderColor string `yaml:"header_color"`
|
||||||
TwitterHandle string `yaml:"twitter_handle"`
|
TwitterHandle string `yaml:"twitter_handle"`
|
||||||
|
GitHubHandle string `yaml:"github_handle"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (user User) Dir() string {
|
func (user User) Dir() string {
|
||||||
|
|
Loading…
Reference in New Issue