2
0

feat(pages): add logo and favicon upload to pages brand settings

Add ability to upload logo and favicon images directly instead of only using URLs. Images stored in repo-avatars storage with hash-based filenames (max 5 MB, JPG/PNG/WebP/GIF). Uploaded images take priority over URL fields. Includes upload/delete endpoints for both logo and favicon, UI with previews, and ResolvedLogoURL/ResolvedFaviconURL helper methods. Updates base_head template to use resolved favicon URL.
This commit is contained in:
2026-03-15 22:45:29 -04:00
parent 79a0c2683e
commit fc86952bf4
8 changed files with 280 additions and 10 deletions

View File

@@ -74,11 +74,29 @@ type LandingConfig struct {
// BrandConfig represents brand/identity settings
type BrandConfig struct {
Name string `yaml:"name,omitempty"`
LogoURL string `yaml:"logo_url,omitempty"`
LogoSource string `yaml:"logo_source,omitempty"` // "url" (default), "repo", or "org" — selects avatar source
Tagline string `yaml:"tagline,omitempty"`
FaviconURL string `yaml:"favicon_url,omitempty"`
Name string `yaml:"name,omitempty"`
LogoURL string `yaml:"logo_url,omitempty"`
UploadedLogo string `yaml:"uploaded_logo,omitempty"`
LogoSource string `yaml:"logo_source,omitempty"` // "url" (default), "repo", or "org" — selects avatar source
Tagline string `yaml:"tagline,omitempty"`
FaviconURL string `yaml:"favicon_url,omitempty"`
UploadedFavicon string `yaml:"uploaded_favicon,omitempty"`
}
// ResolvedLogoURL returns the uploaded logo path or the external URL.
func (b *BrandConfig) ResolvedLogoURL() string {
if b.UploadedLogo != "" {
return "/repo-avatars/" + b.UploadedLogo
}
return b.LogoURL
}
// ResolvedFaviconURL returns the uploaded favicon path or the external URL.
func (b *BrandConfig) ResolvedFaviconURL() string {
if b.UploadedFavicon != "" {
return "/repo-avatars/" + b.UploadedFavicon
}
return b.FaviconURL
}
// HeroConfig represents hero section settings