Disallow indexing of all file pages

This commit is contained in:
2024-08-27 01:29:09 +02:00
parent 062b0df7f1
commit 8887a043c8
4 changed files with 12 additions and 0 deletions

View File

@@ -17,6 +17,9 @@ func (wc *WebController) serveDirectory(w http.ResponseWriter, r *http.Request,
var td = wc.newTemplateData(w, r)
var path = strings.TrimPrefix(p.ByName("path"), "/")
// Prevent search engines from indexing this page for privacy reasons
w.Header().Set("X-Robots-Tag", "noindex, nofollow")
if path == "" {
wc.templates.Get().ExecuteTemplate(w, "404", td)
return