Relative paths in RSS feed.

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Matio
Forum Members
Forum Members
Posts: 17
Joined: Sat Jul 14, 2007 2:54 pm

Relative paths in RSS feed.

Post by Matio »

Hi!

I'm using Calguys Feed Maker to generate RSS feed for my news.

It works fine, but if I don't strip HTML tags from the output (which is what I want) links in news are broken. It's because I'm using pretty URLs and path to my feed is site.com/feeds/news. So my problem is, that I'm using relative path in my news articles, for example

Code: Select all

<img src="img/someimage.jpg">
this image won't load, because feed is located on site.com/feeds/news so rss output for this image is feeds/img/someimage.jpg

Is there any way, to remove that feeds from my RSS URL - so new URL would be site.com/news?

And here is my template (pretty much default):

Code: Select all

{* original rss feed template *}
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
  {* note: if you have not configured pretty urls or mod rewrite, the next line may fail when trying to validate the feed *}
  <atom:link href="{$feed_url}" rel="self" type="application/rss+xml" />
    <title>{$feed.title}</title>
    {if isset($feed.link) && !empty($feed.link)}<link>{$feed.link}</link>{/if}
    {if isset($feed.description) && !empty($feed.description)}<description>{$feed.description}</description>{/if}
    {if isset($feed.copyright) && !empty($feed.copyright)}<copyright>{$feed.copyright}</copyright>{/if}
    {if isset($generator)}<generator>{$generator}</generator>{/if}
    {if isset($feed.managing_editor) && !empty($feed.managing_editor)}<managingEditor>{$feed.managing_editor}</managingEditor>{/if}
    {if isset($admin_email)}<webMaster>{$admin_email} ({$admin_user->firstname} {$admin_user->lastname})</webMaster>{/if}
    {if isset($feed.image) && !empty($feed.image)}
      <image>
	{if isset($feed.description) && !empty($feed.description)}<description>{$feed.description}</description>{/if}
        {if isset($feed.link) && !empty($feed.link)}<link>{$feed.link}</link>{/if}
        <title>{$feed.title}</title>
        <url>{$file_location}/{$feed.image}</url>
      </image>
    {/if}

    {* an example of how to create a feed from a call to the news module *}
    {* you can use any smarty variable that is available in the news summary template *}
    {* you can substitute this logic with output from any module that supports a summary
       view, or possibly get artistic and mix output from different modules *}
    {news assign='junk' number="10"}
    {foreach from=$items item='entry'}
    <item>
      <title>{$entry->title|cms_html_entity_decode}</title>
      <link>{$entry->moreurl}</link>
      {capture assign='description'}{if isset($entry->summary)}{$entry->summary}{else}{$entry->content}{/if}{/capture}
      <description><![CDATA[{$entry->content}]]></description>
      <pubDate>{$entry->postdate|rfc_date}</pubDate>
      <guid>{$entry->moreurl}</guid>
    </item>
    {/foreach}
  </channel>
</rss>
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: Relative paths in RSS feed.

Post by Jeff »

I fixed the problem by going into the TinyMCE admin panel and switching it from relative URLs to full URLs
Matio
Forum Members
Forum Members
Posts: 17
Joined: Sat Jul 14, 2007 2:54 pm

Re: Relative paths in RSS feed.

Post by Matio »

That's actually the thing that I want to avoid.
Post Reply

Return to “Modules/Add-Ons”