2
0

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.
This commit is contained in:
2026-03-16 01:22:52 -04:00
parent c7b5a2af19
commit 5e165b97be
9 changed files with 23 additions and 4 deletions

View File

@@ -305,10 +305,11 @@ func LanguageDisplayNames() map[string]string {
// AdvancedConfig represents advanced settings // AdvancedConfig represents advanced settings
type AdvancedConfig struct { type AdvancedConfig struct {
CustomCSS string `yaml:"custom_css,omitempty"` CustomCSS string `yaml:"custom_css,omitempty"`
CustomHead string `yaml:"custom_head,omitempty"` CustomHead string `yaml:"custom_head,omitempty"`
Redirects map[string]string `yaml:"redirects,omitempty"` Redirects map[string]string `yaml:"redirects,omitempty"`
PublicReleases bool `yaml:"public_releases,omitempty"` PublicReleases bool `yaml:"public_releases,omitempty"`
HideMobileReleases bool `yaml:"hide_mobile_releases,omitempty"`
} }
// ParseLandingConfig parses a landing.yaml file content // ParseLandingConfig parses a landing.yaml file content

View File

@@ -4496,6 +4496,7 @@
"repo.settings.pages.cta_url": "Button URL", "repo.settings.pages.cta_url": "Button URL",
"repo.settings.pages.public_releases": "Public Releases", "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.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.stats": "Stats",
"repo.settings.pages.value_props": "Value Propositions", "repo.settings.pages.value_props": "Value Propositions",
"repo.settings.pages.features": "Features", "repo.settings.pages.features": "Features",

View File

@@ -163,6 +163,7 @@ func setupLandingPageContext(ctx *context.Context, repo *repo_model.Repository,
ctx.Data["LatestReleaseTag"] = strings.TrimPrefix(release.TagName, "v") ctx.Data["LatestReleaseTag"] = strings.TrimPrefix(release.TagName, "v")
} }
ctx.Data["PublicReleases"] = config.Advanced.PublicReleases ctx.Data["PublicReleases"] = config.Advanced.PublicReleases
ctx.Data["HideMobileReleases"] = config.Advanced.HideMobileReleases
} }
// renderLandingPage renders the landing page based on the template // renderLandingPage renders the landing page based on the template

View File

@@ -446,6 +446,7 @@ func PagesContent(ctx *context.Context) {
func PagesContentPost(ctx *context.Context) { func PagesContentPost(ctx *context.Context) {
config := getPagesLandingConfig(ctx) config := getPagesLandingConfig(ctx)
config.Advanced.PublicReleases = ctx.FormBool("public_releases") 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.ShowDocs = ctx.FormBool("nav_show_docs")
config.Navigation.ShowAPI = ctx.FormBool("nav_show_api") config.Navigation.ShowAPI = ctx.FormBool("nav_show_api")
config.Navigation.ShowRepository = ctx.FormBool("nav_show_repository") config.Navigation.ShowRepository = ctx.FormBool("nav_show_repository")

View File

@@ -1337,6 +1337,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{if not $.HideMobileReleases}}
{{if $androidFiles}} {{if $androidFiles}}
<div style="margin-bottom: 24px;"> <div style="margin-bottom: 24px;">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--nb-muted); text-transform: uppercase; letter-spacing: 0.1em;">{{svg "octicon-device-mobile" 16}} Android</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--nb-muted); text-transform: uppercase; letter-spacing: 0.1em;">{{svg "octicon-device-mobile" 16}} Android</h4>
@@ -1353,6 +1354,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{end}}
{{if $otherFiles}} {{if $otherFiles}}
<div style="margin-bottom: 24px;"> <div style="margin-bottom: 24px;">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--nb-muted); text-transform: uppercase; letter-spacing: 0.1em;">{{svg "octicon-file" 16}} Other</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--nb-muted); text-transform: uppercase; letter-spacing: 0.1em;">{{svg "octicon-file" 16}} Other</h4>

View File

@@ -1220,6 +1220,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{if not $.HideMobileReleases}}
{{if $androidFiles}} {{if $androidFiles}}
<div style="margin-bottom: 20px;" class="ea-reveal"> <div style="margin-bottom: 20px;" class="ea-reveal">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ea-light); letter-spacing: 0.08em; text-transform: uppercase;">{{svg "octicon-device-mobile" 14}} Android</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ea-light); letter-spacing: 0.08em; text-transform: uppercase;">{{svg "octicon-device-mobile" 14}} Android</h4>
@@ -1236,6 +1237,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{end}}
{{if $otherFiles}} {{if $otherFiles}}
<div style="margin-bottom: 20px;" class="ea-reveal"> <div style="margin-bottom: 20px;" class="ea-reveal">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ea-light); letter-spacing: 0.08em; text-transform: uppercase;">{{svg "octicon-file" 14}} Other</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ea-light); letter-spacing: 0.08em; text-transform: uppercase;">{{svg "octicon-file" 14}} Other</h4>

View File

@@ -1212,6 +1212,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{if not $.HideMobileReleases}}
{{if $androidFiles}} {{if $androidFiles}}
<div style="margin-bottom: 24px;"> <div style="margin-bottom: 24px;">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--osh-muted); font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.05em; text-transform: uppercase;">{{svg "octicon-device-mobile" 16}} Android</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--osh-muted); font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.05em; text-transform: uppercase;">{{svg "octicon-device-mobile" 16}} Android</h4>
@@ -1228,6 +1229,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{end}}
{{if $otherFiles}} {{if $otherFiles}}
<div style="margin-bottom: 24px;"> <div style="margin-bottom: 24px;">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--osh-muted); font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.05em; text-transform: uppercase;">{{svg "octicon-file" 16}} Other</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--osh-muted); font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.05em; text-transform: uppercase;">{{svg "octicon-file" 16}} Other</h4>

View File

@@ -1338,6 +1338,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{if not $.HideMobileReleases}}
{{if $androidFiles}} {{if $androidFiles}}
<div style="margin-bottom: 24px;"> <div style="margin-bottom: 24px;">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--gm-light); font-weight: 600;">{{svg "octicon-device-mobile" 16}} Android</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--gm-light); font-weight: 600;">{{svg "octicon-device-mobile" 16}} Android</h4>
@@ -1354,6 +1355,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
{{end}}
{{if $otherFiles}} {{if $otherFiles}}
<div style="margin-bottom: 24px;"> <div style="margin-bottom: 24px;">
<h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--gm-light); font-weight: 600;">{{svg "octicon-file" 16}} Other</h4> <h4 style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--gm-light); font-weight: 600;">{{svg "octicon-file" 16}} Other</h4>

View File

@@ -45,6 +45,13 @@
</div> </div>
</div> </div>
<div class="inline field">
<div class="ui toggle checkbox">
<input type="checkbox" name="hide_mobile_releases" {{if .Config.Advanced.HideMobileReleases}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.pages.hide_mobile_releases_desc"}}</label>
</div>
</div>
<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.pages.blog_section"}}</h5> <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.pages.blog_section"}}</h5>
<div class="inline field"> <div class="inline field">
<div class="ui toggle checkbox"> <div class="ui toggle checkbox">