diff --git a/collections.go b/collections.go index a6ade4d..0841f7a 100644 --- a/collections.go +++ b/collections.go @@ -264,12 +264,11 @@ func (c *Collection) PersonObject(ids ...int64) *activitystreams.Person { p.Name = c.DisplayTitle() p.Summary = c.Description if p.Name != "" { - fl := string(unicode.ToLower([]rune(p.Name)[0])) - if isLowerLetter(fl) { + if av := c.AvatarURL(); av != "" { p.Icon = activitystreams.Image{ Type: "Image", MediaType: "image/png", - URL: hostName + "/img/avatars/" + fl + ".png", + URL: av, } } } @@ -287,6 +286,14 @@ func (c *Collection) PersonObject(ids ...int64) *activitystreams.Person { return p } +func (c *Collection) AvatarURL() string { + fl := string(unicode.ToLower([]rune(c.DisplayTitle())[0])) + if !isLowerLetter(fl) { + return "" + } + return hostName + "/img/avatars/" + fl + ".png" +} + func (c *Collection) FederatedAPIBase() string { return hostName + "/" } diff --git a/templates/collection-post.tmpl b/templates/collection-post.tmpl index 6d2dfa0..6f34863 100644 --- a/templates/collection-post.tmpl +++ b/templates/collection-post.tmpl @@ -20,14 +20,14 @@ - {{if gt (len .Images) 0}}{{else}}{{end}} + {{if gt (len .Images) 0}}{{else}}{{end}} - {{range .Images}}{{else}}{{end}} + {{range .Images}}{{else}}{{end}} {{if .Collection.StyleSheet}}{{end}} {{if .Collection.RenderMathJax}} diff --git a/templates/collection-tags.tmpl b/templates/collection-tags.tmpl index 48cb475..021febc 100644 --- a/templates/collection-tags.tmpl +++ b/templates/collection-tags.tmpl @@ -23,10 +23,12 @@ + + {{if .Collection.StyleSheet}}{{end}} {{if .Collection.RenderMathJax}}