mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-21 17:26:55 +01:00
proof of concept for getting latests posts from Medium
This commit is contained in:
parent
ee016e101d
commit
e71b01d51b
1
Gemfile
1
Gemfile
@ -9,4 +9,5 @@ end
|
||||
|
||||
group :jekyll_plugins do
|
||||
gem 'hash-joiner'
|
||||
gem 'simple-rss'
|
||||
end
|
||||
|
@ -90,3 +90,4 @@
|
||||
@import '_sections/section-cta-community';
|
||||
@import '_sections/section-cta-enterprise';
|
||||
@import '_sections/section-partners';
|
||||
@import '_sections/section-blog';
|
||||
|
11
_src/_assets/styles/_sections/_section-blog.scss
Normal file
11
_src/_assets/styles/_sections/_section-blog.scss
Normal file
@ -0,0 +1,11 @@
|
||||
.section--blog {
|
||||
|
||||
}
|
||||
|
||||
.article {
|
||||
|
||||
}
|
||||
|
||||
.article__title {
|
||||
@extend .h6;
|
||||
}
|
@ -16,6 +16,10 @@
|
||||
p {
|
||||
color: $brand-main-gray;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
color: $brand-main-blue;
|
||||
}
|
||||
}
|
||||
|
||||
.background--gray {
|
||||
|
24
_src/_includes/sections/section-blog.html
Normal file
24
_src/_includes/sections/section-blog.html
Normal file
@ -0,0 +1,24 @@
|
||||
<section class="section section--blog background--light">
|
||||
<div class="row row--wide">
|
||||
<header class="section-header">
|
||||
<h1 class="section-title">Hot off the blog</h1>
|
||||
</header>
|
||||
|
||||
<div class="grid grid--full grid-medium--fit grid--gutters">
|
||||
{% for article in site.blog | limit: 3 %}
|
||||
<div class="grid__col">
|
||||
<a class="article article--{{ article.title | downcase | truncatewords: 3, '' | replace: ' ', '-' }}" href="{{ article.link }}">
|
||||
|
||||
<!-- <img src="{{ article.image }}" alt="{{ article.title }}"> -->
|
||||
|
||||
<h1 class="article__title">
|
||||
{{ article.title }}
|
||||
</h1>
|
||||
<p>{{ article.description }}</p>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
40
_src/_plugins/blog.rb
Normal file
40
_src/_plugins/blog.rb
Normal file
@ -0,0 +1,40 @@
|
||||
# http://stackoverflow.com/a/27850727/733677
|
||||
|
||||
require 'open-uri'
|
||||
require 'rss'
|
||||
require 'simple-rss'
|
||||
|
||||
module Jekyll
|
||||
|
||||
# Runs during jekyll build
|
||||
class RssFeedCollector < Generator
|
||||
safe true
|
||||
priority :high
|
||||
def generate(site)
|
||||
|
||||
rss_items = SimpleRSS.parse open('https://blog.bigchaindb.com/feed/')
|
||||
|
||||
# Create a new on-the-fly Jekyll collection called "blog"
|
||||
jekyll_items = Jekyll::Collection.new(site, 'blog')
|
||||
site.collections['blog'] = jekyll_items
|
||||
|
||||
# Add fake virtual documents to the collection
|
||||
rss_items.items.each do |item|
|
||||
title = item.title
|
||||
description = item.description
|
||||
link = item.link
|
||||
image = item.media_content_url
|
||||
path = "_rss/" + title.to_s.gsub(':','_') + ".md"
|
||||
path = site.in_source_dir(path)
|
||||
doc = Jekyll::Document.new(path, site: site, collection: jekyll_items)
|
||||
doc.data['title'] = title
|
||||
doc.data['description'] = description
|
||||
doc.data['link'] = link
|
||||
doc.data['image'] = image
|
||||
jekyll_items.docs << doc
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -59,4 +59,6 @@ redirect_from:
|
||||
|
||||
{% include sections/section-cta-features.html %}
|
||||
|
||||
{% include sections/section-blog.html %}
|
||||
|
||||
{% include ipdb.html %}
|
||||
|
Loading…
Reference in New Issue
Block a user