From 5e165b97be4ea702648bbdd87d39f10cb4f356fb Mon Sep 17 00:00:00 2001 From: logikonline Date: Mon, 16 Mar 2026 01:22:52 -0400 Subject: [PATCH] feat(pages): add option to hide mobile releases from landing page Add HideMobileReleases config option to hide Android and iOS releases from the downloads section on landing pages. Useful when mobile apps are distributed via app stores rather than direct downloads. Adds checkbox in Content settings and conditional rendering in all four page templates. --- modules/pages/config.go | 9 +++++---- options/locale/locale_en-US.json | 1 + routers/web/pages/pages.go | 1 + routers/web/repo/setting/pages.go | 1 + templates/pages/bold-marketing.tmpl | 2 ++ templates/pages/minimalist-docs.tmpl | 2 ++ templates/pages/open-source-hero.tmpl | 2 ++ templates/pages/saas-conversion.tmpl | 2 ++ templates/repo/settings/pages_content.tmpl | 7 +++++++ 9 files changed, 23 insertions(+), 4 deletions(-) diff --git a/modules/pages/config.go b/modules/pages/config.go index 16c208324b..532a7c6a6b 100644 --- a/modules/pages/config.go +++ b/modules/pages/config.go @@ -305,10 +305,11 @@ func LanguageDisplayNames() map[string]string { // AdvancedConfig represents advanced settings type AdvancedConfig struct { - CustomCSS string `yaml:"custom_css,omitempty"` - CustomHead string `yaml:"custom_head,omitempty"` - Redirects map[string]string `yaml:"redirects,omitempty"` - PublicReleases bool `yaml:"public_releases,omitempty"` + CustomCSS string `yaml:"custom_css,omitempty"` + CustomHead string `yaml:"custom_head,omitempty"` + Redirects map[string]string `yaml:"redirects,omitempty"` + PublicReleases bool `yaml:"public_releases,omitempty"` + HideMobileReleases bool `yaml:"hide_mobile_releases,omitempty"` } // ParseLandingConfig parses a landing.yaml file content diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index 4ad73dfbcb..30eed15e68 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -4496,6 +4496,7 @@ "repo.settings.pages.cta_url": "Button URL", "repo.settings.pages.public_releases": "Public Releases", "repo.settings.pages.public_releases_desc": "Allow unauthenticated users to download releases. Useful for landing pages on private repositories.", + "repo.settings.pages.hide_mobile_releases_desc": "Hide mobile platform releases (Android, iOS) from the landing page. Use this when mobile releases are distributed via app stores.", "repo.settings.pages.stats": "Stats", "repo.settings.pages.value_props": "Value Propositions", "repo.settings.pages.features": "Features", diff --git a/routers/web/pages/pages.go b/routers/web/pages/pages.go index 3e352db963..98f4c4c57b 100644 --- a/routers/web/pages/pages.go +++ b/routers/web/pages/pages.go @@ -163,6 +163,7 @@ func setupLandingPageContext(ctx *context.Context, repo *repo_model.Repository, ctx.Data["LatestReleaseTag"] = strings.TrimPrefix(release.TagName, "v") } ctx.Data["PublicReleases"] = config.Advanced.PublicReleases + ctx.Data["HideMobileReleases"] = config.Advanced.HideMobileReleases } // renderLandingPage renders the landing page based on the template diff --git a/routers/web/repo/setting/pages.go b/routers/web/repo/setting/pages.go index 3b9f61e709..ac3d339a0c 100644 --- a/routers/web/repo/setting/pages.go +++ b/routers/web/repo/setting/pages.go @@ -446,6 +446,7 @@ func PagesContent(ctx *context.Context) { func PagesContentPost(ctx *context.Context) { config := getPagesLandingConfig(ctx) config.Advanced.PublicReleases = ctx.FormBool("public_releases") + config.Advanced.HideMobileReleases = ctx.FormBool("hide_mobile_releases") config.Navigation.ShowDocs = ctx.FormBool("nav_show_docs") config.Navigation.ShowAPI = ctx.FormBool("nav_show_api") config.Navigation.ShowRepository = ctx.FormBool("nav_show_repository") diff --git a/templates/pages/bold-marketing.tmpl b/templates/pages/bold-marketing.tmpl index a743ec3b83..7c62261784 100644 --- a/templates/pages/bold-marketing.tmpl +++ b/templates/pages/bold-marketing.tmpl @@ -1337,6 +1337,7 @@ {{end}} + {{if not $.HideMobileReleases}} {{if $androidFiles}}

{{svg "octicon-device-mobile" 16}} Android

@@ -1353,6 +1354,7 @@
{{end}} + {{end}} {{if $otherFiles}}

{{svg "octicon-file" 16}} Other

diff --git a/templates/pages/minimalist-docs.tmpl b/templates/pages/minimalist-docs.tmpl index 096c7a9b34..35b466938a 100644 --- a/templates/pages/minimalist-docs.tmpl +++ b/templates/pages/minimalist-docs.tmpl @@ -1220,6 +1220,7 @@
{{end}} + {{if not $.HideMobileReleases}} {{if $androidFiles}}

{{svg "octicon-device-mobile" 14}} Android

@@ -1236,6 +1237,7 @@
{{end}} + {{end}} {{if $otherFiles}}

{{svg "octicon-file" 14}} Other

diff --git a/templates/pages/open-source-hero.tmpl b/templates/pages/open-source-hero.tmpl index 76683277d4..aadac8ea0a 100644 --- a/templates/pages/open-source-hero.tmpl +++ b/templates/pages/open-source-hero.tmpl @@ -1212,6 +1212,7 @@
{{end}} + {{if not $.HideMobileReleases}} {{if $androidFiles}}

{{svg "octicon-device-mobile" 16}} Android

@@ -1228,6 +1229,7 @@
{{end}} + {{end}} {{if $otherFiles}}

{{svg "octicon-file" 16}} Other

diff --git a/templates/pages/saas-conversion.tmpl b/templates/pages/saas-conversion.tmpl index cc898c1c72..07714a5d49 100644 --- a/templates/pages/saas-conversion.tmpl +++ b/templates/pages/saas-conversion.tmpl @@ -1338,6 +1338,7 @@
{{end}} + {{if not $.HideMobileReleases}} {{if $androidFiles}}

{{svg "octicon-device-mobile" 16}} Android

@@ -1354,6 +1355,7 @@
{{end}} + {{end}} {{if $otherFiles}}

{{svg "octicon-file" 16}} Other

diff --git a/templates/repo/settings/pages_content.tmpl b/templates/repo/settings/pages_content.tmpl index c32eb713f2..da853b4ff5 100644 --- a/templates/repo/settings/pages_content.tmpl +++ b/templates/repo/settings/pages_content.tmpl @@ -45,6 +45,13 @@
+
+
+ + +
+
+
{{ctx.Locale.Tr "repo.settings.pages.blog_section"}}