Commits

Koen Van der Auwera committed 7f08a9f

limit feed posts

  • Participants
  • Parent commits b331408

Comments (0)

Files changed (2)

 
   class Archive < R '/archive'
     def get
+      @posts = $store.posts
       render :archive
     end
   end
 
   class Feed < R '/feed'
     def get
-      Amanda::Feed.rss $store.posts, title: "Koen Van der Auwera's blog", author: "Koen Van der Auwera", url: URL("/").to_s
+      Amanda::Feed.rss $store.posts(9), title: "Koen Van der Auwera's blog", author: "Koen Van der Auwera", url: URL("/").to_s
     end
   end
 
 
   def archive
     ul class: "archive-list" do
-      $store.posts.each {|p| li {a(href: URL(p.url).to_s, title: p.title) { "#{p.published_date} &rarr; #{p.title}" }}}
+      @posts.each {|p| li {a(href: URL(p.url).to_s, title: p.title) { "#{p.published_date} &rarr; #{p.title}" }}}
     end
   end
 end
       Post.from_json(redis.get(redis_post_id))
     end
 
-    def posts
-      redis.zrevrange(POSTS_KEY, 0, -1).map{|p| post(p)}
+    def posts(count=-1)
+      redis.zrevrange(POSTS_KEY, 0, count).map{|p| post(p)}
     end
 
     def random