class Octopress::Linkblog::PostHook

Public Instance Methods

add_post_vars(post) click to toggle source
# File lib/octopress-linkblog.rb, line 39
def add_post_vars(post)
  # Grab external url from post data, reading dashed value for legacy pattern support
  linkpost = post.data['external_url'] || 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_url = File.join('/',post.site.config['baseurl'], post.url)

  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) click to toggle source
# File lib/octopress-linkblog.rb, line 35
def post_init(post)
  add_post_vars(post)
end