Template Functions - URLs

This page contains information about the template functions related to urls:

  • EncodeURI( name: string ): string → URI encodes the argument name;
  • HTMLEscape( name: string ): string → Escapes the argument name, according to HTML rules;
  • XMLEscape( name: string ): string → Escapes the argument name, according to XML rules;
  • JSONEscape( name: string ): string → Escapes the argument name, according to JSON rules;
  • DecodeURI( name: string ): string → URI decodes the argument name;
  • HTMLUnescape( name: string ): string → Unescapes the argument name, according to HTML rules;
  • XMLUnescape( name: string ): string → Unescapes the argument name, according to XML rules;
  • JSONUnescape( name: string ): string → Unescapes the argument name, according to JSON rules;
  • EncodeQuery( params: map[string][]string ): string → Encodes the given map, using URL query encoding;
  • DecodeQuery( query: string ): map[string][]string → Decodes the given url query, to a map;
  • IsURL( name: string ): bool → Checks if the given argument is a valid URL;
  • Scheme( url: string ): string → Returns the scheme of the given url, or empty if the URL is invalid or missing the scheme;
  • UserInfo( url: string ): string → Returns the user info of the given url, or empty if the URL is invalid or missing the user info;
  • Host( url: string ): string → Returns the host of the given url, or empty if the URL is invalid or missing the host;
  • Port( url: string ): int → Returns the port of the given url, or -1 if the URL is invalid or missing the port;
  • Path( url: string ): string → Returns the path of the given url, or empty if the URL is invalid or missing the path;
  • PathComponents(url: string ): []string → Returns a slice with all path components of the given url, or an empty slice if the URL is invalid or missing the scheme;
  • Query( url: string ): string → Returns the query of the given url, or empty if the URL is invalid or missing the query;
  • Fragment( url: string ): string → Returns the fragment of the given url, or empty if the URL is invalid or missing the fragment;