add title

This commit is contained in:
aichy126 2022-12-12 13:54:27 +08:00
parent 952e3d86fa
commit ec739310bb
3 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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}}" />