MCPcopy Index your code
hub / github.com/writefreely/writefreely / DisplayCanonicalURL

Method DisplayCanonicalURL

collections.go:253–266  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251}
252
253func (c *Collection) DisplayCanonicalURL() string {
254 us := c.CanonicalURL()
255 u, err := url.Parse(us)
256 if err != nil {
257 return us
258 }
259 p := u.Path
260 if p == "/" {
261 p = ""
262 }
263 d := u.Hostname()
264 d, _ = idna.ToUnicode(d)
265 return d + p
266}
267
268// RedirectingCanonicalURL returns the fully-qualified canonical URL for the Collection, with a trailing slash. The
269// hostName field needs to be populated for this to work correctly.

Callers

nothing calls this directly

Calls 1

CanonicalURLMethod · 0.95

Tested by

no test coverage detected