From 433214fb91bbb72d0d1215f3b8178efb6c5fddd1 Mon Sep 17 00:00:00 2001 From: logikonline Date: Mon, 16 Mar 2026 02:04:33 -0400 Subject: [PATCH] feat(pages): add app store links to downloads section Add GooglePlayID and AppStoreID config fields to display app store download buttons on landing pages. Shows "App Stores" section with Google Play and/or App Store badges when IDs are configured. Useful for mobile apps distributed via stores instead of direct downloads. Includes branded SVG icons for both stores. Applies to all four page templates. --- modules/pages/config.go | 2 ++ options/locale/locale_en-US.json | 4 ++++ routers/web/pages/pages.go | 2 ++ routers/web/repo/setting/pages.go | 2 ++ templates/pages/bold-marketing.tmpl | 19 +++++++++++++++++++ templates/pages/minimalist-docs.tmpl | 19 +++++++++++++++++++ templates/pages/open-source-hero.tmpl | 19 +++++++++++++++++++ templates/pages/saas-conversion.tmpl | 19 +++++++++++++++++++ templates/repo/settings/pages_content.tmpl | 13 +++++++++++++ 9 files changed, 99 insertions(+) diff --git a/modules/pages/config.go b/modules/pages/config.go index 532a7c6a6b..f5813879b8 100644 --- a/modules/pages/config.go +++ b/modules/pages/config.go @@ -310,6 +310,8 @@ type AdvancedConfig struct { Redirects map[string]string `yaml:"redirects,omitempty"` PublicReleases bool `yaml:"public_releases,omitempty"` HideMobileReleases bool `yaml:"hide_mobile_releases,omitempty"` + GooglePlayID string `yaml:"google_play_id,omitempty"` + AppStoreID string `yaml:"app_store_id,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 30eed15e68..0dbf1915ba 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -4497,6 +4497,10 @@ "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.google_play_id": "Google Play Store ID", + "repo.settings.pages.google_play_id_desc": "Package name from the Play Store URL (e.g. com.example.app)", + "repo.settings.pages.app_store_id": "Apple App Store ID", + "repo.settings.pages.app_store_id_desc": "App ID from the App Store URL (e.g. id123456789)", "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 4cce500103..5f25739ed6 100644 --- a/routers/web/pages/pages.go +++ b/routers/web/pages/pages.go @@ -177,6 +177,8 @@ func setupLandingPageContext(ctx *context.Context, repo *repo_model.Repository, } ctx.Data["PublicReleases"] = config.Advanced.PublicReleases ctx.Data["HideMobileReleases"] = config.Advanced.HideMobileReleases + ctx.Data["GooglePlayID"] = config.Advanced.GooglePlayID + ctx.Data["AppStoreID"] = config.Advanced.AppStoreID } // galleryAssetBaseURL returns the base URL for gallery image assets. diff --git a/routers/web/repo/setting/pages.go b/routers/web/repo/setting/pages.go index ac3d339a0c..61d1f0aedb 100644 --- a/routers/web/repo/setting/pages.go +++ b/routers/web/repo/setting/pages.go @@ -447,6 +447,8 @@ func PagesContentPost(ctx *context.Context) { config := getPagesLandingConfig(ctx) config.Advanced.PublicReleases = ctx.FormBool("public_releases") config.Advanced.HideMobileReleases = ctx.FormBool("hide_mobile_releases") + config.Advanced.GooglePlayID = strings.TrimSpace(ctx.FormString("google_play_id")) + config.Advanced.AppStoreID = strings.TrimSpace(ctx.FormString("app_store_id")) 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 7c62261784..e91f649a1e 100644 --- a/templates/pages/bold-marketing.tmpl +++ b/templates/pages/bold-marketing.tmpl @@ -1355,6 +1355,25 @@ {{end}} {{end}} + {{if or $.GooglePlayID $.AppStoreID}} +
+

{{svg "octicon-device-mobile" 16}} App Stores

+
+ {{if $.GooglePlayID}} + + + Google Play + + {{end}} + {{if $.AppStoreID}} + + + App Store + + {{end}} +
+
+ {{end}} {{if $otherFiles}}

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

diff --git a/templates/pages/minimalist-docs.tmpl b/templates/pages/minimalist-docs.tmpl index 35b466938a..32554e7976 100644 --- a/templates/pages/minimalist-docs.tmpl +++ b/templates/pages/minimalist-docs.tmpl @@ -1238,6 +1238,25 @@
{{end}} {{end}} + {{if or $.GooglePlayID $.AppStoreID}} +
+

{{svg "octicon-device-mobile" 14}} App Stores

+
+ {{if $.GooglePlayID}} + + + Google Play + + {{end}} + {{if $.AppStoreID}} + + + App Store + + {{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 aadac8ea0a..b5b4132665 100644 --- a/templates/pages/open-source-hero.tmpl +++ b/templates/pages/open-source-hero.tmpl @@ -1230,6 +1230,25 @@
{{end}} {{end}} + {{if or $.GooglePlayID $.AppStoreID}} +
+

{{svg "octicon-device-mobile" 16}} App Stores

+
+ {{if $.GooglePlayID}} + + + Google Play + + {{end}} + {{if $.AppStoreID}} + + + App Store + + {{end}} +
+
+ {{end}} {{if $otherFiles}}

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

diff --git a/templates/pages/saas-conversion.tmpl b/templates/pages/saas-conversion.tmpl index 07714a5d49..f41f69a977 100644 --- a/templates/pages/saas-conversion.tmpl +++ b/templates/pages/saas-conversion.tmpl @@ -1356,6 +1356,25 @@
{{end}} {{end}} + {{if or $.GooglePlayID $.AppStoreID}} +
+

{{svg "octicon-device-mobile" 16}} App Stores

+
+ {{if $.GooglePlayID}} + + + Google Play + + {{end}} + {{if $.AppStoreID}} + + + App Store + + {{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 da853b4ff5..0879734983 100644 --- a/templates/repo/settings/pages_content.tmpl +++ b/templates/repo/settings/pages_content.tmpl @@ -52,6 +52,19 @@
+
+
+ + +

{{ctx.Locale.Tr "repo.settings.pages.google_play_id_desc"}}

+
+
+ + +

{{ctx.Locale.Tr "repo.settings.pages.app_store_id_desc"}}

+
+
+
{{ctx.Locale.Tr "repo.settings.pages.blog_section"}}