Keep a list of blog authors in a yaml file.
This commit is contained in:
parent
6b884d34c3
commit
be8e5f5313
11
doc-src/authors.yml
Normal file
11
doc-src/authors.yml
Normal file
@ -0,0 +1,11 @@
|
||||
chris:
|
||||
fullname: Chris Eppstein
|
||||
byline_link: http://chriseppstein.github.com/
|
||||
brandon:
|
||||
fullname: Brandon Mathis
|
||||
eric:
|
||||
fullname: Eric Meyer
|
||||
nico:
|
||||
fullname: Nico Hagenburger
|
||||
scott:
|
||||
fullname: Scott Davis
|
@ -1,5 +1,11 @@
|
||||
- render "blog" do
|
||||
%h1= @item[:title]
|
||||
%h2 By #{@item[:author]}
|
||||
- author = author(@item[:author])
|
||||
%h2
|
||||
By
|
||||
- if author["byline_link"]
|
||||
%a{:href=>author["byline_link"]}= author["fullname"]
|
||||
- else
|
||||
= author["fullname"]
|
||||
= yield
|
||||
-#comments= render "partials/disqus_comments"
|
@ -1,5 +1,6 @@
|
||||
POST_NAME = %r{^/posts/(\d{4})-(\d{2})-(\d{2})-(.*)/$}
|
||||
require 'time'
|
||||
require 'yaml'
|
||||
|
||||
def blog_posts_in_order
|
||||
@blog_posts_in_order ||= @items.select {|i| i.identifier =~ %r{/posts} }.sort_by {|i| i.identifier }
|
||||
@ -24,3 +25,13 @@ def blog_date(item = @item)
|
||||
Time.new($1.to_i, $2.to_i, $3.to_i)
|
||||
end
|
||||
end
|
||||
|
||||
def authors
|
||||
@site.cached("authors") do
|
||||
YAML.load_file("#{File.dirname(__FILE__)}/../authors.yml")
|
||||
end
|
||||
end
|
||||
|
||||
def author(author_id)
|
||||
authors[author_id]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user