Class: Blogo::PostsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Blogo::PostsController
- Defined in:
- app/controllers/blogo/posts_controller.rb
Overview
Responsible for showing posts and atom feeds to visitors.
Constant Summary collapse
- FEED_POSTS_LIMIT =
Number of posts shown in feed.
20
Instance Method Summary collapse
-
#feed ⇒ Object
GET /posts/feed.
-
#index ⇒ Object
GET /posts.
-
#show ⇒ Object
GET /posts/:permalink.
Instance Method Details
#feed ⇒ Object
GET /posts/feed
41 42 43 44 45 46 |
# File 'app/controllers/blogo/posts_controller.rb', line 41 def feed @posts = Post.published.limit(FEED_POSTS_LIMIT) @updated = @posts.first.try(:updated_at) render 'feed', layout: false end |
#index ⇒ Object
GET /posts
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/blogo/posts_controller.rb', line 11 def index @tag = params[:tag] set_vars set_paginator @meta = {} @meta[:title] = "#{Blogo.config.site_title} - #{Blogo.config.site_subtitle}" @meta[:site_name] = Blogo.config.site_title @meta[:keywords] = Blogo.config.keywords @meta[:type] = 'website' end |
#show ⇒ Object
GET /posts/:permalink
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/blogo/posts_controller.rb', line 25 def show @post = Post.published.where(:permalink => params[:permalink]).first! set_vars @meta = {} @meta[:title] = "#{@post.title} - #{Blogo.config.site_title}" @meta[:description] = @post. @meta[:keywords] = [@post., Blogo.config.keywords].flatten.join(", ") @meta[:url] = request.url @meta[:image] = @meta[:type] = 'article' @meta[:site_name] = Blogo.config.site_title end |