Hot answers tagged

17

Here's the boilerplate I've been using for RSS feed templates. I just name the file rss.html and call it a day. This assumes a channel is set up with a description and title field. {% header "Content-Type: application/rss+xml" %} <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> {% set rss = ...


5

?mtime= should only appear for Assets images that are being served from a source that has Expires settings set (so, either an S3 or Google Cloud source). This is done done for cache busting purposes. If you upload a new file, it's mtime value will change causing a different URL and, in turn, forcing the user's browser to serve the new image, instead of the ...


4

I would use a lead paragraph field that you could then call into the RSS feed. Or you could add a post summary field. You could then call that whenever you need to, RSS or otherwise.


4

I don't think it's possible to do with out-of-the-box Twig/Craft, but it's a super-easy plugin to write. All you'd need is to give your plugin a Template Variable so that you could do: {% if craft.myAwesomePlugin.fileExists('somePath') %} YES {% endif %} And your MyAwesomePluginVariable class has a method like: public function fileExists($path) { ...


3

I'm unable to view the feed via the link you've provided - seems like it may not allow public access. In any case, see a working example below using an example public RSS feed. {% set params = { url: 'http://www.feedforall.com/sample.xml', type: 'xml', element: 'item', } %} {% set feed = craft.feedme.feed(params) %} {% for node in feed %} {{ ...


3

Yeah, so I have a rss.twig file in the root of my template directory. {% header "Content-Type: application/rss+xml" %} <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> {% set rss = craft.entries.section('article').limit(10).type('article') %} <channel> <title>My Site Name</...


3

I just used {% header %} and changed it to application/xml instead of application/rss+xml and got the result I was expecting.


2

Until the plugin store becomes an "official thing", the best, most curated list of plugins available for Craft is over at Straight Up Craft. I'm not seeing anything that would do exactly what you're looking for, but it wouldn't be a difficult one to write.


2

Perhaps the following plugin could help to import entries from RSS: Craft CMS plugin to import entries from XML


2

Nothing directly in Craft, but you're probably looking for PHP's max_execution_time, which governs how long a PHP script is allowed to execute. It defaults to 30 seconds. You can edit that value from you php.ini file.


2

I made an article about RSS feed template component for Craft CMS - you can read it here: http://craftsnippets.com/articles/rss-feed-template-component-for-craft-cms


2

As the example actually shows, you'd reference these sort of nodes using the array notation. {{ node['dc:creator'] }}


2

The 3rd parameter passed into getFeedItems is for an offset, not caching. The caching parameter is in the 4th place and accepts any valid PHP time format.


2

As Brad kindly pointed out, I checked my files in the config directory and noticed a few spaces before I started the <?php in my /craft/config/imager.php file. I would never have thought to check this, so thanks Brad!


2

You can’t use dot syntax because of the colon, try this instead {{ feed[0]['itunes:image']['@href'] }}


1

You have named the file feed.rss, and you are trying to access it by going to /rss. So I can see two issues here: The template file needs to be either .html or .twig, as per the tutorial you have referenced The name of the template file will dictate the URL for that template. If you re-name your template file to feed.twig, you access that template by going ...


1

I accidentally had loop inside of the description tag which strangely caused only 17 entries to post to the RSS feed. Below is an example of what was causing the issue: <description><![CDATA[ {% set speaker = craft.categories.group('speaker').relatedTo(entry).find() %} {% for name in speaker %} A Sermon from {{ entry.sermondate | date("l, F j,...


1

If you view the source of the RSS page you're linked to, you'll see the underlying error causing your feed to mess up: Craft\EntryModel and its behaviors do not have a method or closure named "pageDescription". You didn't share your template code, but most like likely you're doing an entry.pageDescription somewhere, but there isn't a field called ...


1

Rey - depending on how you've setup your enries and folder structure you could create feed.rss as a template in both of those folders. Inside the template you can setup the entry loop to output whatever information you need the RSS feed to include. It's not automated but completely within your control.


1

If I am getting you right you have no problem with Craft outputting the content you want. You are rather asking us on what is considered best practice for what content one should deliver with RSS feeds. I'd say it is totally up to you, there's no real standardized way on how to do it right, as far as I can tell. I did have feeds with long read articles and ...


Only top voted, non community-wiki answers of a minimum length are eligible