code: func (p *PathSpec) RelURL(in string, addLanguage bool) string {
  	baseURL := p.BaseURL.String()
  	canonifyURLs := p.CanonifyURLs
  	if (!strings.HasPrefix(in, baseURL) && strings.HasPrefix(in, "http")) || strings.HasPrefix(in, "//") {
  		return in
  	}
  
  	u := in
  
  	if strings.HasPrefix(in, baseURL) {
  		u = strings.TrimPrefix(u, baseURL)
  	}
  
  	if addLanguage {
  		prefix := p.GetLanguagePrefix()
  		if prefix != "" {
  			hasPrefix := false
  			// avoid adding language prefix if already present
  			if strings.HasPrefix(in, "/") {
  				hasPrefix = strings.HasPrefix(in[1:], prefix)
  			} else {
  				hasPrefix = strings.HasPrefix(in, prefix)
  			}
  
  			if !hasPrefix {
  				hadSlash := strings.HasSuffix(u, "/")
  
  				u = path.Join(prefix, u)
  
  				if hadSlash {
  					u += "/"
  				}
  			}
  		}
  	}
  
  	if !canonifyURLs {
  		u = AddContextRoot(baseURL, u)
  	}
  
  	if in == "" && !strings.HasSuffix(u, "/") && strings.HasSuffix(baseURL, "/") {
  		u += "/"
  	}
  
  	if !strings.HasPrefix(u, "/") {
  		u = "/" + u
  	}
  
  	return u
  }
docs: // RelURL creates a URL relative to the BaseURL root.
  // Note: The result URL will not include the context root if canonifyURLs is enabled.