diff --git a/options/locale/custom_keys.json b/options/locale/custom_keys.json index ed9ecbe9da..d2268d5034 100644 --- a/options/locale/custom_keys.json +++ b/options/locale/custom_keys.json @@ -725,6 +725,8 @@ "repo.settings.pages.seo_title": "SEO Title", "repo.settings.pages.seo_description": "Meta Description", "repo.settings.pages.seo_keywords": "Keywords", + "repo.settings.pages.seo_keywords.placeholder": "Add a keyword...", + "repo.settings.pages.seo_keywords.add": "Add", "repo.settings.pages.og_image": "Open Graph Image URL", "repo.vault.plugin_not_installed": "Vault Plugin Not Installed", "repo.vault.plugin_not_installed_desc": "The Vault plugin is not installed on this server. Contact your administrator to enable secrets management.", diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index d9d23eb69e..62c7fe0785 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -4493,6 +4493,8 @@ "repo.settings.pages.seo_title": "SEO Title", "repo.settings.pages.seo_description": "Meta Description", "repo.settings.pages.seo_keywords": "Keywords", + "repo.settings.pages.seo_keywords.placeholder": "Add a keyword...", + "repo.settings.pages.seo_keywords.add": "Add", "repo.settings.pages.og_image": "Open Graph Image URL", "repo.settings.pages.brand_favicon_url": "Favicon URL", "repo.settings.pages.brand_favicon_url_help": "URL to a custom favicon for your landing page (ICO, PNG, or SVG). Leave blank to use the default.", diff --git a/routers/web/repo/setting/pages.go b/routers/web/repo/setting/pages.go index 7245c989d5..d969c60761 100644 --- a/routers/web/repo/setting/pages.go +++ b/routers/web/repo/setting/pages.go @@ -479,7 +479,13 @@ func PagesThemePost(ctx *context.Context) { config.SEO.Description = ctx.FormString("seo_description") keywords := ctx.FormString("seo_keywords") if keywords != "" { - config.SEO.Keywords = strings.Split(keywords, ",") + parts := strings.Split(keywords, ",") + config.SEO.Keywords = make([]string, 0, len(parts)) + for _, kw := range parts { + if trimmed := strings.TrimSpace(kw); trimmed != "" { + config.SEO.Keywords = append(config.SEO.Keywords, trimmed) + } + } } else { config.SEO.Keywords = nil } diff --git a/templates/repo/settings/pages_theme.tmpl b/templates/repo/settings/pages_theme.tmpl index 560b7ad5dc..1911e224f2 100644 --- a/templates/repo/settings/pages_theme.tmpl +++ b/templates/repo/settings/pages_theme.tmpl @@ -73,7 +73,15 @@
- + +
+
+ + +
@@ -87,6 +95,64 @@