Generates an absolute URL to a registered site.
Class Name |
|
---|---|
Component |
|
Input Parameters
siteId
Identifies the site used to generate the URL. If set to null, the generated URL uses the URL of the current site.
path
Path string to include in the generated URL.
queryParams
Query parameters to include in the generated URL.
protocol
The protocol to use—http
or https
—in the generated link. If omitted, the protocol is set from the SiteURLManager property defaultProtocol
.
inInclude
A Boolean flag, specifies whether relative paths should use the URL of the included page.
Output Parameters
output
Rendered if the URL is generated.
url
Set to the generated URL.
error
Rendered if an error occurs.
errorMessage
Contains the error message if an error occurs.
Usage Notes
Given a site ID and optional path, SiteLinkDroplet generates an absolute URL to another site. SiteLinkDroplet constructs URLs for a requested site according to the following rules:
No path supplied: New URL retains old path relative to the new site’s root.
Path contains leading forward slash (
/
): Path is relative to the new site’s root.Path omits leading forward slash (
/
): Path is relative to the current page, on the new site.
URL construction varies depending on whether production site URLs follow a domain-based or path-based strategy. The following examples show how SiteLinkDroplet generates URLs according to these diferent strategies.
Production-site URLs use path-based strategy
Target site’s production site URL:/foo
Current URL:http://domain.com/bar/dir/index.jsp
Input path | New URL |
---|---|
|
|
|
|
|
|
|
|
Production-site URLs use domain-based strategy
Target site’s production site URL:foo.com
Current URL:http://domain.com/dir/index.jsp
Input path | New URL |
---|---|
|
|
|
|
|
|
|
|
Preview query parameters
If a site link is generated on a preview server—that is, a server that is assembled with the –preview
switch—SiteLinkDroplet automatically appends two sticky site query parameters to the generated link: pushSite
and stickySite
. For more information about sticky site parameters, see the Multisite Request Processing chapter in the ATG Platform Programming Guide.
Note: If a site ID contains unconventional characters—for example, @
(at) and ~
(tilde)—you can enter them directly for the input parameter siteId
. However, settings for input parameters path
and queryParams
must use URL encoding for non-alphanumeric characters—for example, %40
and %7E
for at (@
) and tilde (~
) characters, respectively.
Example
See SiteIdForItem.