urlFor(target, options)

Determines the URL of a Scrivito model instance.

The urlFor function can be used on instances of Obj, Binary, and Link.

The origin of the generated URL can be configured using Scrivito.configure(options). If, for example, the origin is set to “https://example.com”, the resulting URL of the above call would be “https://example.com/?foo#bar”.

Params

  • target​ (Object) – An instance of Obj, Binary or Link.
  • options (Object) – Optional hash for specifying the query and hash to be appended to the URL.

Returns

String – The URL of the given model instance.

Remarks

If urlFor is applied to a Link instance, the link’s query and hash values, if present, are passed through to urlFor. However, they can be overridden by specifying them in options.

The fragment key has been renamed to hash; fragment is now deprecated.