From 6140ebeeba8fc8ac2b775fd3521684e46844bbfa Mon Sep 17 00:00:00 2001 From: akuma06 Date: Fri, 5 May 2017 17:14:10 +0200 Subject: [PATCH] Added RSS link & context display --- router/router.go | 2 +- router/templateFunctions.go | 7 +++++++ templates/index.html | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/router/router.go b/router/router.go index c6422e8e..bbcbe490 100644 --- a/router/router.go +++ b/router/router.go @@ -26,6 +26,6 @@ func init() { Router.HandleFunc("/api/{page}", ApiHandler).Methods("GET") Router.HandleFunc("/api/view/{id}", ApiViewHandler).Methods("GET") Router.HandleFunc("/faq", FaqHandler).Name("faq") - Router.HandleFunc("/feed.xml", RssHandler) + Router.HandleFunc("/feed.xml", RssHandler).Name("feed") Router.HandleFunc("/view/{id}", ViewHandler).Name("view_torrent") } \ No newline at end of file diff --git a/router/templateFunctions.go b/router/templateFunctions.go index 1b8618a7..a2fad90f 100644 --- a/router/templateFunctions.go +++ b/router/templateFunctions.go @@ -17,6 +17,13 @@ var FuncMap = template.FuncMap{ } return "error" }, + "genRouteWithQuery": func(name string, currentUrl *url.URL, params ...string) template.HTML { + url, err := Router.Get(name).URL(params...) + if err == nil { + return template.HTML(url.String()+ "?" + currentUrl.RawQuery) + } + return "error" + }, "genNav": func(nav Navigation, currentUrl *url.URL, pagesSelectable int) template.HTML { maxPages := math.Ceil(float64(nav.TotalItem) / float64(nav.MaxItemPerPage)) diff --git a/templates/index.html b/templates/index.html index f5bc84e7..21de1d34 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,6 +7,10 @@ Nyaa Pantsu - {{block "title" .}}Error 404{{end}} + + + + @@ -39,6 +43,7 @@
  • Fap
  • FAQ
  • IRC
  • +
  • Feed RSS