Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Added RSS link & context display

Cette révision appartient à :
akuma06 2017-05-05 17:14:10 +02:00
Parent bc4414d988
révision 40cef1186c
3 fichiers modifiés avec 13 ajouts et 1 suppressions

Voir le fichier

@ -26,6 +26,6 @@ func init() {
Router.HandleFunc("/api/{page}", ApiHandler).Methods("GET") Router.HandleFunc("/api/{page}", ApiHandler).Methods("GET")
Router.HandleFunc("/api/view/{id}", ApiViewHandler).Methods("GET") Router.HandleFunc("/api/view/{id}", ApiViewHandler).Methods("GET")
Router.HandleFunc("/faq", FaqHandler).Name("faq") 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") Router.HandleFunc("/view/{id}", ViewHandler).Name("view_torrent")
} }

Voir le fichier

@ -17,6 +17,13 @@ var FuncMap = template.FuncMap{
} }
return "error" 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 { "genNav": func(nav Navigation, currentUrl *url.URL, pagesSelectable int) template.HTML {
maxPages := math.Ceil(float64(nav.TotalItem) / float64(nav.MaxItemPerPage)) maxPages := math.Ceil(float64(nav.TotalItem) / float64(nav.MaxItemPerPage))

Voir le fichier

@ -7,6 +7,10 @@
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Nyaa Pantsu - {{block "title" .}}Error 404{{end}}</title> <title>Nyaa Pantsu - {{block "title" .}}Error 404{{end}}</title>
<link rel="icon" type="image/png" href="/img/favicon.png" /> <link rel="icon" type="image/png" href="/img/favicon.png" />
<!-- RSS Feed with Context -->
<link href="{{ genRouteWithQuery "feed" .URL }}" rel="alternate" type="application/rss+xml" title="Nyaa Pantsu - {{block "rsstitle" .}}Last torrents{{end}} RSS Feed" />
<!-- Latest compiled and minified CSS --> <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
@ -39,6 +43,7 @@
<li><a href="https://sukebei.pantsu.cat">Fap</a></li> <li><a href="https://sukebei.pantsu.cat">Fap</a></li>
<li><a href="{{.URL.Parse "/faq"}}">FAQ</a></li> <li><a href="{{.URL.Parse "/faq"}}">FAQ</a></li>
<li><a href="irc://irc.rizon.net/nyaapantsu">IRC</a></li> <li><a href="irc://irc.rizon.net/nyaapantsu">IRC</a></li>
<li><a href="{{ genRouteWithQuery "feed" .URL }}">Feed RSS</a></li>
</ul> </ul>
<form class="navbar-form navbar-right" role="search" action="/search" method="get"> <form class="navbar-form navbar-right" role="search" action="/search" method="get">
<div class="form-group"> <div class="form-group">