This class provides methods for looking up the relations between URLs and the content they represent, in both directions.
Fetches content information for a URL.
If a URL cannot be found but there exists a redirect for it, then a Moved response is returned containing the new URL. If neither a URL nor a redirect is found while a) the request was made to the root of a domain and b) this domain is owned by a shop, then a Moved response is returned pointing to the start page of the shop, in the default language of the shop.
Parameter | Description |
---|---|
url | The full URL of a webshop page. |
query | Which info to return (optional). See Query language. |
A request for a URL pointing to an Article.
Url.get("https://demobutik.com/ecommerce/textalk-demo/men/in-hac-habitasse", true)
A request for a URL pointing to an Article where we explicity asks for URLs in all active languages.
Url.get("https://demobutik.com/en/in-hac-habitasse", {
"webshop": true,
"type": true,
"language": true,
"article": true,
"articlegroup": true,
"customPage": true,
"shoppingList": true,
"url": true,
"languageUrls": true
})
The example below is a request for an Article that has got a new URL and returns a redirect.
url.get("https://demobutik.com/old/article/url")
Looks up a URL by the type and object it represents. The correct Webshop must be set in the context.
Parameter | Description |
---|---|
type | Object type as one of "Article" , "Articlegroup" , "CustomPage" , "StartPage" or "Moved" . |
object | The unique identifier of the object depending on type, e.g. for the type "Article", object is the unique identifier of an Article. Use null for StartPage. |
language | A language code of an active language in the webshop. |
variant | Optional. For article pages, this can be the unique identifier of an Articlegroup in which the article should appear. For types other than "Article" , variant is not used. |
Url.lookup("Article", 12565483, "en")