Class: Blogo::PostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/blogo/posts_controller.rb

Constant Summary collapse

FEED_POSTS_LIMIT =

Number of posts shown in feed.

20

Instance Method Summary collapse

Instance Method Details

#feedObject



34
35
36
37
38
39
# File 'app/controllers/blogo/posts_controller.rb', line 34

def feed
  @posts   = published_posts.limit(FEED_POSTS_LIMIT)
  @updated = @posts.first.try(:updated_at)

  render 'feed', layout: false
end

#indexObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/blogo/posts_controller.rb', line 8

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

#showObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/blogo/posts_controller.rb', line 20

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_description
  @meta[:keywords]      = [@post.tags_string, Blogo.config.keywords].flatten.join(", ")
  @meta[:url]           = request.url
  @meta[:image]         = meta_image
  @meta[:type]          = 'article'
  @meta[:site_name]     = Blogo.config.site_title
end