Permalink
Browse files

Full length rss feed

  • Loading branch information...
khawkins98 committed Feb 9, 2018
1 parent b00a115 commit e0b010fcc664f61d32cce6f705ffa7d2fc760fec
Showing with 34 additions and 5 deletions.
  1. +21 −0 src/helpers/compileBlogPostForRSS.js
  2. +13 −5 src/pages/rss.html
@@ -0,0 +1,21 @@
/**
* compileBlogPostForRSS: pass a blog post and break out just the body.
* @param {mixed} source - Template text
* @param {object} options - Handlebars object.
* @returns Rendered post
*/
module.exports = function(source, options) {
// console.log('split: ', String(options), options)
var compiled = options.fn(source);

// keep text only after title
compiled = String(compiled).split("{{title}}")[1];
// keep text before footer
compiled = String(compiled).split("{{> footer}}")[0];

// remove any {{markdown}}s
var re = /{{#?\/?markdown}}/gi;
var compiled = compiled.replace(re, '');

return compiled;
}
@@ -9,16 +9,24 @@
<language>en-us</language>
<managingEditor>khawkins98@gmail.com (Ken Hawkins)</managingEditor>
<webMaster>khawkins98@gmail.com (Ken Hawkins)</webMaster>
{{#each blog}}

{{#each pages as |individualPage pageKey|}}
{{#each individualPage}}
{{#ifequal this.active_path "blog"}}
<item>
<title>{{this.title}}</title>
<description>
<![CDATA[
<img src="http://work.allaboutken.com/images/crop-square{{this.image}}" />
{{this.teaser}}]]>
<img class="callout" src="https://work.allaboutken.com/images/crop-cinema{{this.image}}" />
{{#markdown}}
{{#compileBlogPostForRSS this}}{{{ individualPage }}}{{/compileBlogPostForRSS}}
{{/markdown}}
]]>
</description>
<link>http://work.allaboutken.com{{root}}{{this.url}}</link>
<guid>http://work.allaboutken.com{{root}}{{this.url}}</guid>
<link>https://work.allaboutken.com{{this.url}}</link>
<guid>https://work.allaboutken.com{{this.url}}</guid>
<pubDate>{{this.date}}</pubDate>
</item>
{{/ifequal}}
{{/each}}
{{/each}}

0 comments on commit e0b010f

Please sign in to comment.