summaryrefslogtreecommitdiffci
path: root/internal/router/handlers/root.go
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'internal/router/handlers/root.go')
-rw-r--r--internal/router/handlers/root.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/internal/router/handlers/root.go b/internal/router/handlers/root.go
index 89b9c63..4fc4e31 100644
--- a/internal/router/handlers/root.go
+++ b/internal/router/handlers/root.go
@@ -1,6 +1,7 @@
package handlers
import (
+ "fmt"
"time"
"github.com/SayaAndy/saya-today-web/internal/router"
@@ -36,14 +37,20 @@ func (r *RootHandler) CacheDuration() time.Duration {
}
func (r *RootHandler) SitemapInfo(_ *router.Supplements) []router.SitemapInfo {
- return []router.SitemapInfo{{Loc: "", Priority: 0.7}}
+ return []router.SitemapInfo{{Loc: "/", Priority: 0.7}}
}
-func (r *RootHandler) AddMeta(c *fiber.Ctx, supplements *router.Supplements, lang string, templateMap fiber.Map) (meta map[string]string, err error) {
- return map[string]string{
- "og:title": "Saya Blog",
- "og:description": "The blog of a 25 years old, travelling God knows where, proud to be not mainstream // Личный блог 25-летки, странствующего по ебеням, зато не мейнстрим",
- }, nil
+func (r *RootHandler) AddMeta(c *fiber.Ctx, supplements *router.Supplements, lang string, templateMap fiber.Map) (meta []router.MetaField, err error) {
+ meta = []router.MetaField{
+ {Property: "og:title", Content: "Saya Blog"},
+ {Property: "og:description", Content: "The blog of a 25 years old, travelling God knows where, proud to be not mainstream // Личный блог 25-летки, странствующего по ебеням, зато не мейнстрим"},
+ {Property: "og:url", Content: fmt.Sprint(templateMap["CanonicalEndpoint"]) + "/"},
+ {Property: "og:type", Content: "website"},
+ }
+ for _, field := range supplements.Meta {
+ meta = append(meta, router.MetaField{Name: field.Name, Content: field.Value})
+ }
+ return meta, nil
}
func (r *RootHandler) RenderBody(c *fiber.Ctx, supplements *router.Supplements, _ string, templateMap fiber.Map) (statusCode int, err error) {