Class: Octopress::LinkBlog::PostHook

Inherits:
Hooks::Post
  • Object
show all
Defined in:
lib/octopress-linkblog.rb

Instance Method Summary collapse

Instance Method Details

#add_post_vars(post) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/octopress-linkblog.rb', line 39

def add_post_vars(post)
  linkpost = post.data['external-url']

  post.data['title'].titlecase! if LinkBlog.config['titlecase']

  if linkpost
    config = LinkBlog.config['linkpost']
  else
    config = LinkBlog.config['post']
  end

  post.data['title_text'] = LinkBlog.post_title_text(post.data['title'], config)
  post.data['title_html'] = LinkBlog.post_title_html(post.data['title'], config)
  post.data['title_url']  = linkpost || post.url
  post.data['linkpost']   = !linkpost.nil?
  post.data['title_link'] = LinkBlog.post_title_link(post.data)
  post.data['permalink']  = LinkBlog.post_link(LinkBlog.config['permalink_label'], post.url, 'article-permalink')
 
  post
end

#post_init(post) ⇒ Object



35
36
37
# File 'lib/octopress-linkblog.rb', line 35

def post_init(post)
  add_post_vars(post)
end