1
mirror of https://github.com/jlelse/GoBlog synced 2024-07-15 11:02:58 +00:00

Add blogroll header

This commit is contained in:
Jan-Lukas Else 2024-05-21 16:42:32 +02:00
parent e14104cd16
commit 7da7cd36f9
2 changed files with 6 additions and 4 deletions

View File

@ -10,10 +10,7 @@ import (
)
func (ntfy *configNtfy) enabled() bool {
if ntfy == nil || !ntfy.Enabled || ntfy.Topic == "" {
return false
}
return true
return ntfy != nil && ntfy.Enabled && ntfy.Topic != ""
}
func (a *goBlog) sendNtfy(cfg *configNtfy, msg string) error {

5
ui.go
View File

@ -1,6 +1,7 @@
package main
import (
"cmp"
"fmt"
"time"
@ -45,6 +46,10 @@ func (a *goBlog) renderBase(hb *htmlbuilder.HtmlBuilder, rd *renderData, title,
hb.WriteElementOpen("link", "rel", "alternate", "type", "application/rss+xml", "title", fmt.Sprintf("RSS (%s)", renderedBlogTitle), "href", a.getFullAddress(rd.Blog.Path+".rss"))
hb.WriteElementOpen("link", "rel", "alternate", "type", "application/atom+xml", "title", fmt.Sprintf("ATOM (%s)", renderedBlogTitle), "href", a.getFullAddress(rd.Blog.Path+".atom"))
hb.WriteElementOpen("link", "rel", "alternate", "type", "application/feed+json", "title", fmt.Sprintf("JSON Feed (%s)", renderedBlogTitle), "href", a.getFullAddress(rd.Blog.Path+".json"))
// Blogroll
if brConf := rd.Blog.Blogroll; brConf != nil && brConf.Enabled {
hb.WriteElementOpen("link", "rel", "blogroll", "type", "text/xml", "href", rd.Blog.getRelativePath(cmp.Or(brConf.Path, defaultBlogrollPath)+".opml"))
}
// Webmentions
hb.WriteElementOpen("link", "rel", "webmention", "href", a.getFullAddress("/webmention"))
// Micropub