mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
fix(route): handle subdomain removal in URL construction for homepage items
This commit is contained in:
@@ -122,6 +122,9 @@ func HomepageItems(proto, hostname, categoryFilter, providerFilter string) homep
|
|||||||
// append hostname if provided and only if alias is not FQDN
|
// append hostname if provided and only if alias is not FQDN
|
||||||
if hostname != "" && item.URL == "" {
|
if hostname != "" && item.URL == "" {
|
||||||
if !strings.Contains(item.Alias, ".") {
|
if !strings.Contains(item.Alias, ".") {
|
||||||
|
if strings.Count(hostname, ".") > 1 {
|
||||||
|
_, hostname, _ = strings.Cut(hostname, ".") // remove the subdomain
|
||||||
|
}
|
||||||
item.URL = fmt.Sprintf("%s://%s.%s", proto, item.Alias, hostname)
|
item.URL = fmt.Sprintf("%s://%s.%s", proto, item.Alias, hostname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user