feat: make home welcome/subtitle configurable and fix settings render

Add home_welcome and home_subtitle fields (zh/en) to site_settings so
the home page heading and subtitle are editable from the admin panel,
falling back to the i18n defaults when empty. Wire them through the
config cache, SetUserContext, DefaultData, and home.html.

Fix the /admin/settings/site page rendering blank: Go templates cannot
invoke methods on an interface{}-wrapped struct, so pre-compute
SiteLogoIsURL in the handler instead of calling .Site.LogoIsURL() in
the template.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 20:41:45 +08:00
co-authored by Claude Fable 5
parent e3367e6e12
commit 0c5bcde7da
7 changed files with 89 additions and 8 deletions
+2
View File
@@ -103,6 +103,8 @@ func SetUserContext(db *gorm.DB) gin.HandlerFunc {
c.Set("site_logo_is_url", site.LogoIsURL())
c.Set("site_logo_text", site.LogoText(string(lang)))
c.Set("site_header_text", site.HeaderText(string(lang)))
c.Set("site_home_welcome", site.HomeWelcome(string(lang)))
c.Set("site_home_subtitle", site.HomeSubtitle(string(lang)))
c.Set("site_footer_text", site.FooterText(string(lang)))
c.Next()