mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Add tag description.
This commit is contained in:
@@ -40,7 +40,7 @@ func handleRobotsTxt(c fiber.Ctx) error {
|
||||
c.Set("Content-Type", "text/plain; charset=utf-8")
|
||||
c.Set("Cache-Control", "no-cache")
|
||||
c.Set("X-Robots-Tag", "noindex")
|
||||
return c.SendString("User-agent: *\nDisallow: /api/\nDisallow: /admin/\n")
|
||||
return c.SendString("User-agent: *\nDisallow: /api/\n\nSitemap: " + c.BaseURL() + "/sitemap.xml\n")
|
||||
}
|
||||
|
||||
func handleSiteMap(c fiber.Ctx) error {
|
||||
@@ -92,6 +92,13 @@ func serveIndexHtml(c fiber.Ctx) error {
|
||||
title = u.Username
|
||||
description = "User " + u.Username + "'s profile"
|
||||
}
|
||||
} else if strings.HasPrefix(path, "/tag/") {
|
||||
tagName := strings.TrimPrefix(path, "/tag/")
|
||||
t, err := service.GetTagByName(tagName)
|
||||
if err == nil {
|
||||
title = "Tag: " + t.Name
|
||||
description = utils.ArticleToDescription(t.Description, 256)
|
||||
}
|
||||
}
|
||||
|
||||
content = strings.ReplaceAll(content, "{{SiteName}}", siteName)
|
||||
|
Reference in New Issue
Block a user