Generate absolute URL

Hi,
I did an RSS feeds using auto index slot and everything is working fine exept the link to the items. RSS item nead to have absolute URL and when using “$rx.location.generate($sys.assemblyItem)” it generate relative URL. Is there is a way to generate absolute URL it my case ?

Thanks,

Guillaume

Guillaume,

Try adding this to your bindings:


$link = $rx.location.generate($sys.assemblyItem, "rss_feed_page")
if ($sys.assemblyItem.context > 0) { $siteBase = $rx.location.siteBase($siteId,"false");} else {}

And then this in your template:

<link>$!siteBase$link</link>

Obviously, your template page may have a different name, but this should get you started down the right path.

Dave

Hi Dave,

Thanks for your help. I understand what your trying to do with that. My problem is that in my sites definition, I don’t have the full location (http://www.hec.ca) because we have multiple sites that publish in different location. So instead, for publishing purpose, I only have “blank”, “/en” or “/es” (our 3 sites). Is there’s a way I can use the Home Page (URL) of the sites definition ? I would then have this instead :

if ($sys.assemblyItem.context > 0) { $siteBase = Home Page (URL);} else {}

Regards,

Guillaume

Hi,

Forget my previous response. I changed our sites configuration to have the full URL under the site addresses and I’m now using a variable for my publishing issue (/en or /es before the folder path).

With your code, I’m now able to have the full URL in my RSS feeds.

Thanks for your time and help,

Guillaume

Hi,
When I’m using this function

$rx.location.siteBase($siteId,"false")

How can I get the siteId ? When I’m using

$sys.site.id

I get “0-9-305” instead of only “305” and I have this error message

Unexpected exception while assembling one or more items: Problem when evaluating expression "if ($sys.assemblyItem.context > 0) { $siteBase = $rx.location.siteBase($sys.site.id,"false");} else {};" for variable "$siteBase": Could not find method siteBase for object [com.percussion.services.assembly.jexl.PSLocationUtils@1a1099f] and arguments [0-9-305,false]

If I hardcode “305” instead of calling the $sys.site.id fonction, it work fine.
Thanks,

Guillaume

Try

$sys.params.sys_siteid[0]

Dave

Thanks, it work perfectly.
Regards,
Guillaume