aboutsummaryrefslogtreecommitdiff
path: root/cmd/server/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/server/handlers.go')
-rw-r--r--cmd/server/handlers.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/server/handlers.go b/cmd/server/handlers.go
index 60e0a35..5ea89cd 100644
--- a/cmd/server/handlers.go
+++ b/cmd/server/handlers.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"net/http"
"path/filepath"
@@ -8,9 +9,20 @@ import (
"riedstra.dev/mitch/go-website/page"
)
+var FeedPrefixDefault = ".feeds"
+
type App struct {
ReIndexPath string
StaticDirectory string
+
+ // Related to the Atom feed
+ Title string
+ Description string // aka, "subtitle"
+ Author Author
+ SiteURL string
+ FeedId string
+ Updated page.PageTime
+ FeedPrefix string
}
func (a *App) PageHandler(w http.ResponseWriter, r *http.Request) {
@@ -48,6 +60,7 @@ func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request) {
rtr := mux.NewRouter()
rtr.HandleFunc(a.ReIndexPath, a.RebuildIndexHandler)
rtr.PathPrefix("/static/").Handler(a.StaticHandler())
+ rtr.PathPrefix(fmt.Sprintf("/%s/{tag}", a.FeedPrefix)).HandlerFunc(a.FeedHandler)
rtr.PathPrefix("/").HandlerFunc(a.PageHandler)
rtr.ServeHTTP(w, r)
}