package server import ( "net/url" "strings" "pageswiki/internal/store" ) // Names identify Streets only within their parent Quartier. UUID references // remain available for stable identity across renames and moves. func cityDetailHref(kind, name, quartierName, uuid string) string { prefix := map[string]string{"quartier": "q", "street": "s", "spot": "p"}[strings.ToLower(kind)] if prefix == "" { return "/v/city" } ref := "uuid:" + uuid if name != "" && (prefix != "s" || quartierName != "") { ref = url.PathEscape(name) if prefix == "s" { ref = url.PathEscape(quartierName) + "/" + ref } } else { ref = url.PathEscape(ref) } return "/v/city/" + prefix + "/" + ref } func canReadCityNode(node store.CityNodeDetail, allowed func(string) bool) bool { return allowed(node.PathPrefix) && (node.Quartier == nil || allowed(node.Quartier.PathPrefix)) && (node.Street == nil || allowed(node.Street.PathPrefix)) } func cityPageHref(path string) string { return (&url.URL{Path: path}).EscapedPath() } // Search is a reading entry point, not a locality management shortcut. Both // title and Path links use this projection; no additional per-hit DB reads. func cityContentHref(result store.CitySearchResult) string { path := result.ContentPath() if !strings.HasPrefix(path, "/") || strings.HasPrefix(path, "//") { return "/v/browser" } if result.HasPage { return cityPageHref(path) } return cityPageHref("/v/browser" + path) } type cityPageView struct { store.CityPagePlacement Href string }