summaryrefslogtreecommitdiffci
path: root/internal/router/handlers/robots.txt.go
blob: fc60af4eaa608cd89332b50f78b6f077a95231f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package handlers

import (
	"time"

	"github.com/SayaAndy/saya-today-web/internal/router"
	"github.com/gofiber/fiber/v2"
)

type RobotsTxtHandler struct {
	router.BasicHandler
}

func init() {
	router.Routes = append(router.Routes, &RobotsTxtHandler{})
}

func (r *RobotsTxtHandler) Filter() (method string, path string) {
	return "GET", "/robots.txt"
}

func (r *RobotsTxtHandler) IsTemplated() bool {
	return false
}

func (r *RobotsTxtHandler) TemplatesToInject() []string {
	return []string{"views/pages/robots.txt"}
}

func (r *RobotsTxtHandler) ToCache() router.CacheSetting {
	return router.ByUrlOnly
}

func (r *RobotsTxtHandler) CacheDuration() time.Duration {
	return time.Hour
}

func (r *RobotsTxtHandler) ToValidateLang() router.LangSetting {
	return router.NotRequired
}

func (r *RobotsTxtHandler) ContentType() string {
	return fiber.MIMETextPlainCharsetUTF8
}

func (r *RobotsTxtHandler) Render(c *fiber.Ctx, supplements *router.Supplements, lang string, templateMap fiber.Map) (statusCode int, err error) {
	return fiber.StatusOK, nil
}