func feedHandler(req *web.Request) { if !feedburner.Match([]byte(req.Header.Get(web.HeaderUserAgent))) { // Not Feedburner if "" == req.Param.Get("no_fb") { // And nothing saying to ignore req.Respond(web.StatusMovedPermanently, web.HeaderLocation, feedburnerUrl) return } } posts, err := posts.FindLatest(10) if err != nil { logger.Printf("failed getting posts for feed: %s", err) serverError(req, err) } else { w := req.Respond(web.StatusOK, web.HeaderContentType, "application/rss+xml; charset=utf-8") view.RenderPartial(w, "feed.tmpl", &view.RenderInfo{ Post: posts, SiteTitle: config.SiteTitle, SiteDescription: config.SiteDescription, SiteContact: config.SiteContact, SiteAuthor: config.SiteAuthor, }) } }
func sitemapHandler(req *web.Request) { posts, err := posts.FindLatest(posts.Len()) if err != nil { logger.Printf("failed getting posts for sitemap: %s", err) serverError(req, err) } else { w := req.Respond(web.StatusOK, web.HeaderContentType, "application/xml; charset=utf-8") view.RenderPartial(w, "sitemap.tmpl", &view.RenderInfo{Post: posts}) } }
func opensearchHandler(req *web.Request) { w := req.Respond(web.StatusOK, web.HeaderContentType, "application/xml; charset=utf-8") view.RenderPartial(w, "opensearch.tmpl", nil) }