Linkmaker html7/7/2023 So, suppose every sitemap item for the contact page in every language has hst:refId = 'contactId'. Every sitemap should then have the contact sitemap item set to the same hst:refId. For this purpose, a siteMapItemRefId can be used. However, the URL for the contact page is different for every language because every language has its own HST sitemap. When you have multiple sites in multiple languages, you want to use the same JSP to say, create a hard-coded link to the contact page. My pdf Create a URL for a siteMapItemRefId Then this will create a repository binary link: JSP Suppose the binary is at /content/assets/mypdfs/test.pdf. If you want to create a binary URL by pointing to a repository location, this can be done by using the attr path and prefix the absolute repository location by /binaries. The HST linkrewriting makes sure for the beans correct binary URLs are created. Normally, you access a repository binary resource just like any other JCR node through a HippoBean wrapper. Create a URL for a Repository Resource when you know the Exact Location If you want a preferred URL, add a child to the tagĬreate a URL for a Container Resource (For Example a CSS).If you want a navigationalStateful URL, add navigationalStateful=true to the link tag.If you want a canonical URL, add canonical=true to the link tag.The same as above in a Freemarker template is as follows: Note that out-of-the-box, the examples below for HippoBean are cross-domain, multi-site, context and channel aware! Create a URL for a HippoBeanĪssume you stored some HippoBean objects in the documents variable below, then the JSP for creating URLs for these documents is: If the attribute is missing, the value is directly written to the rendered output of the template. The tag takes an optional attribute var in which the String output is stored. It automatically includes the context path in the URL when this is needed. The tag is a tag that can create URLs for HippoBeans, for JCR nodes, for repository binaries, repository webfiles and for static resources. See at the end of this page for all the possible attributes. Therefore, the HST provides a custom tag, the tag. Most of the time however, you won't need to create a URL in a HstComponent Java class, but rather create one in during the rendering of the template (jsp/freemarker). String Url = link.toUrlForm(request.getRequestContext(), false) HstLink link = linkCreator.create(myBean, HstLinkCreator linkCreator = request.getRequestContext() HippoBean myBean = request.getRequestContext().getContentBean() resolved sitemap item's its relative content path) getting hold of the HippoBean for the current request (the In a HstComponent that extends from the ., you can access the HstLinkCreator as follows: public abstract class AbstractSearchComponent extends BaseHstComponent void doBeforeRender(HstRequest request, HstResponse response) NavigationStateful URLs : URLs taking the current navigation state into account, for example to get a URL in the context of the current faceted navigation location.Preferred URLs : URLs for a specific part of the SiteMap only.Canonical URLs : A URL that is independent of the context of the current URL (highly appreciated by search engines like Google, Yahoo, see canonical links).Context Aware URLs : URLs for one and the same document can be different according the context of the current URL.Channel Aware URLs : mobile URLs stay within the mobile channels, while the URLs same content for the normal website stays within the website.Even cross domain and cross scheme links combined are supported. Cross Scheme : URLs from http to https and vice versa.Cross Domain / Multi Site URLs : URLs between subsites, even with different domains.For link rewriting the HST supports by default: The HST does this automatically, based on the configuration of the SiteMap: It is the Request Matching reversed. The HST supports link rewriting to URLs for internal links between Hippo Documents stored in Hippo Repository. The HST creates out-of-the-box URLs for a page, a repository binary resource or a container resource (like CSS or image). Combined with Apache HTTP Server configured as reverse proxy the HST can serve any scheme ( http/https), domain and port and can be deployed with any context path: This way the HST application can be deployed as for example site.war, but does not show the /site context path in the URL. It takes care of including or excluding the context path, hence, should be used for every URL, also for static resources like CSS. Context Aware, Canonical, Preferred and navigationStateful URLsīloomreach Experience Manager's delivery tier (HST) provides URL creation out-of-the-box.
0 Comments
Leave a Reply. |