0

I am trying to get a multi-channel RSS feed working. The feed seems to populate correctly if I use: <link>{title_permalink="site/index"}</link>, but as you can guess then each article just takes the subscriber to the index of the site.

I tried <link>{title_permalink="{page_url}"}</link>, but that broke the feed completely and it wouldn't populate.

How do I get it so that each entry in the feed links directly to the specific content item, regardless of channel?

My full XML code is here:

{preload_replace:master_channel_name="articles|blogs|news|reports"}
{preload_replace:master_channel_status="OPEN"}
{preload_replace:master_rss_uri="https://ntecheresearch.com/rss/content"}

{exp:rss:feed channel="{master_channel_name}" status="{master_channel_status}"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
    xmlns:dc="https://purl.org/dc/elements/1.1/"
    xmlns:atom="https://www.w3.org/2005/Atom">
    <channel>
    <title>{exp:xml_encode}n-tech Rearch RSS Feed{/exp:xml_encode}</title>
    <link>{channel_url}</link>
    <description></description>
    <dc:language>{channel_language}</dc:language>
    <dc:creator>{email}</dc:creator>
    <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
    <pubDate>{gmt_date format="%D, %d %M %Y %H:%i:%s %T"}</pubDate>
    <atom:link href="{master_rss_uri}" rel="self" type="application/rss+xml" />   
{exp:channel:entries channel="{master_channel_name}" limit="30" rdf="off" dynamic_start="on" disable="member_data|trackbacks" status="{master_channel_status}"}
    <item>
      <title>{exp:xml_encode protect_entities="yes"}{title}{/exp:xml_encode}</title>
      <link>{title_permalink="{page_url}"}</link>
      <guid isPermaLink="false">{title_permalink="site/index"}#id:{entry_id}#date:{gmt_entry_date format="%H:%i"}</guid>
      <description><![CDATA[{summary}]]></description>
      {categories}<category>{exp:xml_encode protect_entities="yes"}{category_name}{/exp:xml_encode}</category>
      {/categories}
      <pubDate>{gmt_entry_date format="%D, %d %M %Y %H:%i %T"}</pubDate>
    </item>
{/exp:channel:entries}
    </channel>
</rss>
{/exp:rss:feed}

1 Answer 1

2

<link>{title_permalink="{page_url}"}</link> will never work because the title_permalink will be parsed before page_url. page_url also just works on Page Module.

It looks like the channels you're trying to add to the feed use different templates, which makes impossible to use the {url_title_path=""}. Is it?

If so, you have two options.

first one

You can use {relative_url}, which returns the value of the Channel URL on its settings.

For each <item>, use:

<link>{relative_url}/{url_title}</link>

Or, if you're using root relative links on channels settings, which I prefer:

<link>{site_url}{relative_url}/{url_title}</link>

second one

Conditionals! Check for the channel_short_name:

{if channel_short_name == "x"}
    <link>{title_permalink='x_template_group'} [...]
{if:else}
    <link>{title_permalink='y_template_group'} [...]
{/if}
2
  • Brilliant! The root relative links example fixed it. Thanks so much! Commented Apr 24, 2015 at 21:25
  • @BrookeMartinChao, please, after test the answer, mark it as right to make easier to other having the same doubt. I'm glad I help you!
    – Sobral
    Commented Apr 25, 2015 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.