data-sly-call clientLib Absolute URL | Community
Skip to main content
mikal_morello
October 16, 2015
Solved

data-sly-call clientLib Absolute URL

  • October 16, 2015
  • 5 replies
  • 1841 views

Is there anyway to output the clientLib resources as absolute urls?

EXAMPLE CODE

<output data-sly-call="${clientLib.all @ categories='cq.jquery'}"  data-sly-unwrap></output>

CURRENT OUTPUT

<script type="text/javascript" src="/etc/clientlibs/granite/jquery.js"></script>
<script type="text/javascript" src="/etc/clientlibs/granite/utils.js"></script>
 

WANTED OUTPUT

<script type="text/javascript" src="http://MYSITE.COM/etc/clientlibs/granite/jquery.js"></script>
<script type="text/javascript" src="http://MYSITE.COM/etc/clientlibs/granite/utils.js"></script>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Hi,

you can implement your own rewriter [1], which rewrites certain URLs to include the full hostname. Or you can implement mod_proxy on the calendar system to fetch the data from AEM instead.

kind regards,
Jörg

 

[1] https://sling.apache.org/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter.html

5 replies

joerghoh
Adobe Employee
Adobe Employee
October 16, 2015

Hi,

in that case it might be easiest approach to customize the rewriter, so you can externalize these URLs. By default they are relative, which is normally a good idea. Why do you want to have a hostname in this URLs?

kind regards,
Jörg

October 16, 2015

Hey Mikal, given what you're trying to do the best option would be to make the CSS files available in the DAM.  When you activate the CSS file from the DAM the cache will be cleared on the dispatcher and your external application will receive the latest, most up to date file.  If you do something like you're trying to accomplish, you'll have to clear the dispatcher cache manually when you need to update your external application (because /etc/ does not get flushed) - not to mention that writing a custom rewriter to provide this functionality is a lot of work for no gain.

mikal_morello
October 16, 2015

Thanks for the response. 

The reason I was looking to have the hostname in the URLs, is that we are integrating our website with a 3rd party calendar system.  The calendar requires a template shell that they draw into their site around the calendar functionality (subdomain.website.com).  This template shell requires that any resources (CSS/JS/Images) have hard coded urls to point back to the actual file location, and not relative url.

I was hoping to create an AEM template for the shell based upon our existing templates, that would automatically update with any code changes.  For example, drawing in the header, footer, navigation, and resources.  This way we won't need to make duplicate modifications to the shell template when we update our site, since it will automatically happen.

Long story short, I was trying to come up with a way to avoid making redundant changes on templates, specifically those created for 3rd party integrations. 

Does that make sense?

mikal_morello
October 16, 2015

Thanks Lee.  I will just hard code the files urls in for now, and try to remember to change them manually if/when we change them.

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi,

you can implement your own rewriter [1], which rewrites certain URLs to include the full hostname. Or you can implement mod_proxy on the calendar system to fetch the data from AEM instead.

kind regards,
Jörg

 

[1] https://sling.apache.org/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter.html