활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
I have a servlet on my page template at sitemap.xml.jsp that I'm using to generate a sitemap dynamically. I'm running into an issue with the display of the urls.
The output currently displays like:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://dispatcher.localhost:8080/content/online/</loc> <lastmod>2017-03-15</lastmod> <priority>1</priority> </url> <url> <loc> http://dispatcher.localhost:8080/content/online/academics </loc> <lastmod>2017-02-23</lastmod> <priority>0.667</priority> </url> <url> <loc> http://dispatcher.localhost:8080/content/online/apply-today </loc> <lastmod>2017-02-24</lastmod> <priority>0.667</priority> </url> <url> <loc> http://dispatcher.localhost:8080/content/online/cincinnati-online-experience </loc> <lastmod>2017-01-02</lastmod> <priority>0.667</priority> </url> ...
As you can see in the <loc> element, instead of the domain (in this case http://online.uc.edu) it's showing a dispatcher url along with the /content/online
A correct URL would be http://online.uc.edu/cincinnati-online-experience
I'm using externalizer.absoluteLink(), but that doesn't seem to be working in this case. Heres the relevent parts of my jsp file:
public Element getPageNode(Page page, Document doc, Externalizer externalizer, ResourceResolver resourceResolver, SlingHttpServletRequest request,int ogDepth) { //Create a result element Element url = doc.createElement( "url" ); Element loc = doc.createElement( "loc" ); loc.appendChild( doc.createTextNode( externalizer.absoluteLink(request, request.getScheme(), page.getPath()))); url.appendChild( loc ); return url; }
Do I need to change a setting in the externalizer config to make the absolute link work?
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
Hi, Ben.
Yes, there is a specific setting for Externalizer: http://<host>:<port>/system/console/configMgr/com.day.cq.commons.impl.ExternalizerImpl
You can configure a "domain" and use its name as the second parameter of externalLink call.
For further info, please check: https://docs.adobe.com/docs/en/aem/6-2/develop/platform/externalizer.html
Be aware that some Sling Mappings may also influence the links generated by the Externalizer.
Regards,
Daniel.
조회 수
답글
좋아요 수
Hi, Ben.
Yes, there is a specific setting for Externalizer: http://<host>:<port>/system/console/configMgr/com.day.cq.commons.impl.ExternalizerImpl
You can configure a "domain" and use its name as the second parameter of externalLink call.
For further info, please check: https://docs.adobe.com/docs/en/aem/6-2/develop/platform/externalizer.html
Be aware that some Sling Mappings may also influence the links generated by the Externalizer.
Regards,
Daniel.
조회 수
답글
좋아요 수
Be aware that some Sling Mappings may also influence the links generated by the Externalizer.
How it will influence?
In externalizer in set the domain name as www.abc.com.
In etc.dev.publish, i have sling mappings with 2 domains: 1. www.xyz.com and www.abc.com
When sitemap is generating, it is generating the urls with www.xyz.com/home. How can i avoid it?
조회 수
답글
좋아요 수
Try externalizer.externalLink(..). Make sure you have configuration for Externalizer domain
조회 수
답글
좋아요 수
Or you can simply use Sling Mappings (reverse mapping) and ResourceResolver.map to achieve the same result.
Regards,
Daniel.
조회 수
답글
좋아요 수
조회 수
Likes
답글