Create a URLCmpnt tag
The URLCmpnt tag generates a URL to a site area or content item.
Format for URLCmpnt tag:
[URLCmpnt mode=" " context=" " type=" " name=" " pageDesign=" " portalTarget=" " targetCurrentPortalPage=" " usedIn=" " start=" " end=" " htmlencode=" "]Create a URLCmpnt tag:
- Click Insert a Tag from a presentation template or element design field. The Tag Helper dialog opens.
- Select URL as the tag type.
- Select a mode type. This determines the type of URL generated. This is added to the tag as the mode=" " parameter:
Mode Details mode="portal" This generates a URL to a portal page. This is used when displaying web content within a web content viewer portlet mode="standAlone" This generates a URL to a web page. This is used when displaying web content using the WCM servlet. mode="current" This generates a URL based on the format of the current request. For example, if the current request is a HCL WebSphere Portal request, then mode="portal" is used.
- Select the item type and the context used to determine which URL to reference:
Context type="auto" type="content" type="sitearea" type="parent" type="top" context="Selected" If selected, the context is set by the selected item. We select an item by clicking Select. This is added to the tag as the name=" " parameter:
Display the URL of the selected item. Display the URL of the selected content item. If a site area is selected then nothing will be displayed.
If the selected item is a site area, then this will display the URL of the site area If the selected item is a content item, then this will display the URL of the parent site area of the content item.
Display the URL of the parent of the selected item. Display the URL of the first item in the path of the selected item. context="Current" If selected, the context is set by the current item.
Display the URL of the item currently being rendered. Display the URL of the current content item. If a site area is selected then nothing will be displayed.
If the item currently being rendered is a site area, this will display the URL of the current site area. If the item currently being rendered is a content item, this will display the URL of the parent site area of the content item.
Display the URL of the parent site area of the item currently being rendered. Display the URL of the first item in the path of the item currently being rendered. context="Autofill" Use this option when the item being referenced is determined by the search parameters of a menu, navigator, or taxonomy component. If the tag is not used within a menu, navigator, or taxonomy component, the context will revert to the current item.
Display the URL of the item returned by a menu, navigator, or taxonomy component. Display the URL of a content item returned by a menu, navigator, or taxonomy component. If a site area is selected then nothing will be displayed.
If the current item returned by a menu, navigator, or taxonomy component is a site area, then the URL of the site area will be displayed. If the current item returned by a menu, navigator, or taxonomy component is a content item, then the URL of the parent of the content item will be displayed.
Display the URL of the parent item of the item returned by a menu, navigator, or taxonomy component. Display the URL of the first item in the path of the item returned by a menu, navigator, or taxonomy component. context="portalContext" If selected, the context is set by the context of the current page. This option is only valid for content delivered using a web content viewer portlet.
Display the URL of the current page context item. If the context of the current page is a content item, the URL of the current content item is displayed. If the context of the current page is a site area, the URL of the default content item of the site area is displayed.
If the context of the current page is a site area, the URL of the site area is displayed. If the context of the current page is a content item, the URL of the parent of the content item is displayed.
Display the URL of the parent of the current page context item. Display the URL of the first item in the path of the current page context item. context="portalMapping" If selected, the context is set by the content mapping of the current page. This option is only valid for content delivered using a web content viewer portlet.
Display the URL of the item selected as the default content mapping of the page. Display the URL of the default content item of the site area selected as the default content mapping of the page. Display the URL of the site area selected as the default content mapping of the page. Display the URL of parent of the item selected as the default content mapping of the page. Display the URL of the first item in the path of the item selected as the default content mapping of the page.
- If we select context=Current or context=Autofill, click Select authoring template to select an appropriate authoring template.
- To render the content using an alternative presentation templates, click presentation template. This is added to the tag as the pageDesign=" " parameter.
- Select Portal Page Target to render the content on a specific Portal page. We can enter the compound name of the URL mapping or friendly URL of the target portal page in the tag after you add the tag to the design. This can only be used if mode="current" or mode="portal". This is added to the tag as the portalTarget=" " parameter.
- Click OK to add the tag to your design.
What to do next
Once we have added the tag to the design, we can also add the following parameters to the tag:
Tag parameters Details name=" " If we specify name="./itemName", the actual path is not resolved until the item is rendered. This takes slightly longer to resolve than specifying the path to the item. usedIn=" " To use the URL in JavaScript, add the parameter usedIn="script" to the tag. htmlencode=" " If htmlencode="true" the reserved HTML characters in text, short text and option selection elements are converted into character entities. For example, '<' is converted to '<'. This is useful if to prevent users adding malicious code, or to prevent users changing the look and feel of their text using HTML. If not specified, the default setting specified by the cmpnt.htmlEncodeDefault property in the WCM WCMConfigService service is used. By default, this property is set to true.
start=" " end=" "
The start and end attributes are used to wrap the data returned by a tag within other tags, such as HTML. These attributes are not mandatory. targetCurrentPortalPage=" " Set targetCurrentPortalPage="true" to render the content on the portal page that is the current page when the URL is selected. Use this parameter only if mode="current" or mode="portal" and if the portalTarget parameter is not set.
Parent Create web content tags