adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
724 stars 737 forks source link

[Link Handling][Search] Apply URL mapping and vanity URLs to search result links #426

Open tim-merrillcorp opened 5 years ago

tim-merrillcorp commented 5 years ago

We have created mapping under /etc/map to remove the /content/mywebsite text from the url across the site. However, there doesn't appear to be a way to remove the /content/mywebsite text from the search results.

We are on AEM 6.4, service package 6.4.2. Core Components version 2.0.4.

richardhand commented 5 years ago

@tim-merrillcorp, thanks for your report, I moved the second issue to #427.

As the results are provided on the fly, it seems like they're not run through the default link rewriter and therefore require handling to ensure they are mapped correctly.

gabrielwalt commented 4 years ago

This should be fixed by #713.

kwin commented 4 years ago

As #713 might take some time, why not simply calling RR.map(...) on the JSON value in the mean time? Would you accept a PR for that?

The least changes would mean adjusting https://github.com/adobe/aem-core-wcm-components/blob/345377e9701a6724abc8ddf5a1fc5c3ade85f406/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/Utils.java#L61 but it is hard to estimate the side-effects!

kwin commented 4 years ago

@vladbailescu WDYT about a fix which would just call RR.map on https://github.com/adobe/aem-core-wcm-components/blob/345377e9701a6724abc8ddf5a1fc5c3ade85f406/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/Utils.java#L61?

vladbailescu commented 4 years ago

@kwin, it would require some testcases to make sure it does not break stuff, but could be a solution. We would appreciate some help here, especially with the testcases.

kwin commented 3 years ago

@vladbailescu Isn't this solved in 2.16.0 (https://github.com/adobe/aem-core-wcm-components/blob/2e055f9d4a1777155229dae22d948ce7ec095a42/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/servlets/SearchResultServlet.java#L305)?

olenaslyshkova commented 2 years ago

As I can see the issue is still reproducible on the core component version 2.17.10. Can be also seen in the https://wknd.site/us/en.html site (search for "magazine") which uses the 2.16.4 core components version.

cpiosecny commented 1 month ago

The results in SearchResultServlet are getting wrapped in PageListItemImpl which is calling LinkManager to build a Link. The LinkImpl created in LinkBuilderImpl sets the url field to the sanitized "URL", which just is the sanitized path. This gets exposed via LinkImpl#getURL to the PageListItemImpl#getURL and clearly is not a URL