mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-22 01:36:55 +01:00
commit
8422c87b25
@ -8,18 +8,18 @@ module Jekyll
|
|||||||
|
|
||||||
# Runs during jekyll build
|
# Runs during jekyll build
|
||||||
class RssFeedCollector < Generator
|
class RssFeedCollector < Generator
|
||||||
safe true
|
safe true
|
||||||
priority :high
|
priority :high
|
||||||
def generate(site)
|
def generate(site)
|
||||||
|
|
||||||
rss_items = SimpleRSS.parse open('https://blog.bigchaindb.com/feed/')
|
rss_items = SimpleRSS.parse open('https://blog.bigchaindb.com/feed/')
|
||||||
|
|
||||||
# Create a new on-the-fly Jekyll collection called "articles"
|
# Create a new on-the-fly Jekyll collection called "articles"
|
||||||
jekyll_items = Jekyll::Collection.new(site, 'articles')
|
jekyll_items = Jekyll::Collection.new(site, 'articles')
|
||||||
site.collections['articles'] = jekyll_items
|
site.collections['articles'] = jekyll_items
|
||||||
|
|
||||||
# Add fake virtual documents to the collection
|
# Add fake virtual documents to the collection
|
||||||
rss_items.items.each do |item|
|
rss_items.items.each do |item|
|
||||||
title = item.title
|
title = item.title
|
||||||
link = item.link
|
link = item.link
|
||||||
|
|
||||||
@ -33,9 +33,10 @@ module Jekyll
|
|||||||
doc.data['link'] = link
|
doc.data['link'] = link
|
||||||
doc.data['image'] = image
|
doc.data['image'] = image
|
||||||
jekyll_items.docs << doc
|
jekyll_items.docs << doc
|
||||||
end
|
end
|
||||||
|
rescue
|
||||||
end
|
puts "Could not parse blog feed. Are you offline?"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -125,7 +125,13 @@ export const jekyll = (done) => {
|
|||||||
|
|
||||||
const jekyll = cp.execFile('bundle', ['exec', jekyll_options], { stdio: 'inherit' })
|
const jekyll = cp.execFile('bundle', ['exec', jekyll_options], { stdio: 'inherit' })
|
||||||
|
|
||||||
jekyll.on('error', (error) => onError() ).on('close', done)
|
const jekyllLogger = (buffer) => {
|
||||||
|
buffer.toString()
|
||||||
|
.split(/\n/)
|
||||||
|
.forEach((message) => console.log(message))
|
||||||
|
}
|
||||||
|
|
||||||
|
jekyll.stdout.on('data', jekyllLogger).on('close', done)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user