Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

add title

aichy126ec739310bbea
diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.go
index c0744663..860ff4d1 100644
--- a/internal/controller/template_controller.go
+++ b/internal/controller/template_controller.go
@@ -388,6 +388,10 @@ func (tc *TemplateController) html(ctx *gin.Context, code int, tpl string, siteI
if siteInfo.Description == "" {
siteInfo.Description = siteInfo.General.Description
}
+ data["title"] = siteInfo.Title
+ if siteInfo.Title == "" {
+ data["title"] = siteInfo.General.Name
+ }
data["description"] = siteInfo.Description
data["language"] = handler.GetLang(ctx)
data["timezone"] = siteInfo.Interface.TimeZone
diff --git a/internal/schema/siteinfo_schema.go b/internal/schema/siteinfo_schema.go
index d83d7195..500ad38e 100644
--- a/internal/schema/siteinfo_schema.go
+++ b/internal/schema/siteinfo_schema.go
@@ -109,6 +109,7 @@ type TemplateSiteInfoResp struct {
General *SiteGeneralResp `json:"general"`
Interface *SiteInterfaceResp `json:"interface"`
Branding *SiteBrandingResp `json:"branding"`
+ Title string
Year string
Canonical string
JsonLD string
diff --git a/ui/template/header.html b/ui/template/header.html
index a402f3ba..17013bcd 100644
--- a/ui/template/header.html
+++ b/ui/template/header.html
@@ -5,6 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>{{.title}}</title>
<meta name="description" content="{{.description}}" />
{{if .keywords }}<meta name="keywords" content="{{.keywords}}" />{{end}}
<link rel="canonical" href="{{.siteinfo.Canonical}}" />