Browse Source

Support dynamic links on profile

main
Matt Baer 6 years ago
parent
commit
b2e8d72bab
2 changed files with 7 additions and 5 deletions
  1. +1
    -5
      templates/profile.tmpl
  2. +6
    -0
      user.go

+ 1
- 5
templates/profile.tmpl View File

@@ -22,11 +22,7 @@
</div>
<div>
<ul class="buttons">
<li><a href="http://domain.tld/path" class="button n01">Twitter</a></li>
<li><a href="http://domain.tld/path" class="button n02">Mastodon</a></li>
<li><a href="http://domain.tld/path" class="button n03">Pixelfed</a></li>
<li><a href="http://domain.tld/path" class="button n04">Instagram</a></li>
<li><a href="http://domain.tld/path" class="button n05">Whatever Else</a></li>
{{range .Links}}<li><a href="{{.URL}}" class="button">{{.Title}}</a></li>{{end}}
</ul>
</div>
</div>


+ 6
- 0
user.go View File

@@ -13,8 +13,14 @@ type Profile struct {
Name converter.NullJSONString `json:"name"`
Header converter.NullJSONString `json:"header"`
Bio converter.NullJSONString `json:"bio"`
Links []Link `json:"links"`
}

func (p *Profile) RenderedBio() template.HTML {
return template.HTML(p.Bio.String)
}

type Link struct {
Title string `json:"title"`
URL string `json:"url"`
}

Loading…
Cancel
Save