Sha256: 8898fbe4260388a7a396194ec5fdf6060af45d13a063795c88d331e7f27c2fbc
Contents?: true
Size: 1.84 KB
Versions: 3
Compression:
Stored size: 1.84 KB
Contents
# middleman-medium Fetches posts preview from Medium Feed If what you need is to build a preview of you latest medium posts on your site this is the right middleman extension for you. Just add it to your `config.rb` file like any other middleman extension. ```ruby activate :middleman_medium, source: 'https://blog.continuum.cl/feed' ``` The source option must be the feed of your medium account, which normaly is `https://medium.com/feed/YOUR-ACCOUNT` The method `fetch_medium_posts` is exposed to the templates and return an array of Hashes with the following structure: ```ruby [ { title: "La verdadera experiencia de usuario", date: 2018-05-23 17:18:33 +0000, url: "https://blog.continuum.cl/la-verdadera-experiencia-de-usuario-4683f3f1236a? source=rss----d66605ce046d---4", category: "continuous-delivery", img: "https://cdn-images-1.medium.com/max/1024/1*CEEf5FiezbTxPLOmt4hntg.jpeg" }, { title:"Las 7 razones por las que falla un proyecto digital", date: 2018-05-29 13:59:44 +0000, url: "https://blog.continuum.cl/las-7-razones-por-las-que-falla-un-proyecto-digital-1de23ac573bb?source=rss----d66605ce046d---4", category: "ux-research", img: "https://cdn-images-1.medium.com/max/1024/1*CE_9F97oNWK0mN3ROT0Nhg.jpeg" } ] ``` Receiving this Hash gives you the possibility to build the preview of the posts the way you want, here is an example using an `erb` template: ```html <div class="blogposts-grid"> <%- fetch_medium_posts.each do |post| %> <div class="blogposts-grid-item"> <a href="<%= post[:url] %>" target="blank"> <div class="blogposts-item-image" style="background-image: url('<%= post[:img] %>')"></div> <div class="blogposts-item-caption"> <h3><%= post[:title] %></h3> <h6><%= post[:category] %></h6> </div> </a> </div> <% end %> </div> ```
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
middleman-medium-0.0.3 | README.md |
middleman-medium-0.0.2 | README.md |
middleman-medium-0.0.1 | README.md |