fix: Make Pages subdomain URL clickable and display proper domain
Some checks failed
Build and Release / Create Release (push) Has been skipped
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 1m31s
Build and Release / Lint (push) Failing after 1m54s
Build and Release / Build Binaries (amd64, darwin) (push) Has been skipped
Build and Release / Build Binaries (amd64, linux) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin) (push) Has been skipped
Build and Release / Build Binaries (arm64, linux) (push) Has been skipped
Build and Release / Unit Tests (push) Successful in 1m59s

- Show full URL instead of just subdomain
- Make it a clickable hyperlink with target=_blank
- Use setting.Domain for proper URL construction
This commit is contained in:
Claude Code 2026-01-11 00:45:29 +01:00
parent 7292421334
commit 853ff29ae2
3 changed files with 5 additions and 3 deletions

View File

@ -41,6 +41,7 @@ func Pages(ctx *context.Context) {
// Generate subdomain
ctx.Data["PagesSubdomain"] = pages_service.GetPagesSubdomain(ctx.Repo.Repository)
ctx.Data["PagesURL"] = pages_service.GetPagesURL(ctx.Repo.Repository)
// Available templates
ctx.Data["PagesTemplates"] = []string{"simple", "documentation", "product", "portfolio"}

View File

@ -180,8 +180,9 @@ func GetPagesSubdomain(repo *repo_model.Repository) string {
func GetPagesURL(repo *repo_model.Repository) string {
subdomain := GetPagesSubdomain(repo)
// This should be configurable
pagesDomain := setting.AppURL // TODO: Add proper pages domain setting
return fmt.Sprintf("https://%s.pages.%s", subdomain, pagesDomain)
// Extract domain from settings
domain := setting.Domain
return fmt.Sprintf("https://%s.pages.%s", subdomain, domain)
}
// GetPagesDomains returns all custom domains for a repository's pages

View File

@ -8,7 +8,7 @@
<div class="ui positive message">
<div class="header">{{ctx.Locale.Tr "repo.settings.pages.enabled"}}</div>
<p>{{ctx.Locale.Tr "repo.settings.pages.enabled_desc"}}</p>
<p><strong>{{ctx.Locale.Tr "repo.settings.pages.subdomain"}}:</strong> <code>{{.PagesSubdomain}}</code></p>
<p><strong>{{ctx.Locale.Tr "repo.settings.pages.subdomain"}}:</strong> <a href="{{.PagesURL}}" target="_blank" rel="noopener noreferrer">{{.PagesURL}}</a></p>
</div>
<form class="ui form" method="post">