From 51efdd822f21b7585bf6c5ce52bce9552d2c8ac0 Mon Sep 17 00:00:00 2001 From: aichy126 <16996097+aichy126@users.noreply.github.com> Date: Mon, 12 Dec 2022 14:09:14 +0800 Subject: [PATCH] update html title --- internal/controller/template_controller.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.go index 860ff4d1..d5a850c5 100644 --- a/internal/controller/template_controller.go +++ b/internal/controller/template_controller.go @@ -103,6 +103,7 @@ func (tc *TemplateController) Index(ctx *gin.Context) { if siteInfo.General.PermaLink == schema.PermaLinkQuestionIDAndTitle { UrlUseTitle = true } + siteInfo.Title = "" tc.html(ctx, http.StatusOK, "question.html", siteInfo, gin.H{ "data": data, "useTitle": UrlUseTitle, @@ -131,7 +132,7 @@ func (tc *TemplateController) QuestionList(ctx *gin.Context) { if siteInfo.General.PermaLink == schema.PermaLinkQuestionIDAndTitle { UrlUseTitle = true } - + siteInfo.Title = fmt.Sprintf("Questions-%s", siteInfo.General.Name) tc.html(ctx, http.StatusOK, "question.html", siteInfo, gin.H{ "data": data, "useTitle": UrlUseTitle, @@ -266,7 +267,7 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) { tags = append(tags, tag.DisplayName) } siteInfo.Keywords = strings.Replace(strings.Trim(fmt.Sprint(tags), "[]"), " ", ",", -1) - + siteInfo.Title = fmt.Sprintf("%s-%s", detail.Title, siteInfo.General.Name) tc.html(ctx, http.StatusOK, "question-detail.html", siteInfo, gin.H{ "id": id, "answerid": answerid, @@ -291,6 +292,7 @@ func (tc *TemplateController) TagList(ctx *gin.Context) { siteInfo := tc.SiteInfo(ctx) siteInfo.Canonical = fmt.Sprintf("%s/tags", siteInfo.General.SiteUrl) + siteInfo.Title = fmt.Sprintf("%s-%s", "Tags", siteInfo.General.Name) tc.html(ctx, http.StatusOK, "tags.html", siteInfo, gin.H{ "page": page, "data": data, @@ -326,7 +328,7 @@ func (tc *TemplateController) TagInfo(ctx *gin.Context) { if siteInfo.General.PermaLink == schema.PermaLinkQuestionIDAndTitle { UrlUseTitle = true } - + siteInfo.Title = fmt.Sprintf("%s-%s", taginifo.DisplayName, siteInfo.General.Name) tc.html(ctx, http.StatusOK, "tag-detail.html", siteInfo, gin.H{ "tag": taginifo, "questionList": questionList, @@ -369,6 +371,7 @@ func (tc *TemplateController) UserInfo(ctx *gin.Context) { siteInfo := tc.SiteInfo(ctx) siteInfo.Canonical = fmt.Sprintf("%s/users/%s", siteInfo.General.SiteUrl, username) + siteInfo.Title = fmt.Sprintf("%s-%s", username, siteInfo.General.Name) tc.html(ctx, http.StatusOK, "homepage.html", siteInfo, gin.H{ "userinfo": userinfo, "bio": template.HTML(userinfo.Info.BioHTML),