package mestionora import ( "path" "strings" ) // A display projection only: names, boundaries and manual titles remain stored // unchanged. Legacy generated Spots have no nested Spot semantics. func IsUnclassifiedCitySpot(name, boundary string) bool { return strings.HasSuffix(name, "-undefined") || strings.HasSuffix(boundary, "/_undefined") } func CitySpotDisplayTitle(name, title, boundary, parentTitle string) string { if !IsUnclassifiedCitySpot(name, boundary) { if title != "" { return title } return name } switch strings.ToLower(strings.TrimSpace(title)) { case "", "undefined", "未定義", "未分類のpage", "unclassified pages", strings.ToLower(name): if parentTitle != "" { return parentTitle } if parent := path.Base(path.Dir(boundary)); parent != "/" && parent != "." { return parent } return "Spot" default: return title // A manual display title takes precedence. } } func (r CitySearchResult) DisplayTitle() string { if r.Kind == "spot" { return CitySpotDisplayTitle(r.Name, r.Title, r.PathPrefix, r.StreetTitle) } if r.Title != "" { return r.Title } return r.Name } func (r CitySearchResult) ContentPath() string { if r.NavigationPath != "" { return r.NavigationPath } return r.PathPrefix }