diff --git a/lib/blog_article.rb b/lib/blog_article.rb index eefb5f9..434f1aa 100644 --- a/lib/blog_article.rb +++ b/lib/blog_article.rb @@ -6,12 +6,29 @@ def authors end def author_permalinks - data.authors ? data.authors.split(',').map{|author| Middleman::BlogAuthors::AuthorPages.permalink(author)} : [] + if data.author + if data.author.kind_of?(Array) + authors = data.author + else + authors = [data.author] + end + else + authors = data.authors ? data.authors.split(',') : [] + end + authors.map { |author| Middleman::BlogAuthors::AuthorPages.permalink(author) } end def author_names - data.authors ? data.authors.split(',').map{|author| author.strip} : [] + if data.author + if data.author.kind_of?(Array) + data.author + else + [data.author] + end + else + data.authors ? data.authors.split(',').map{ |author| author.strip } : [] + end end end end -end \ No newline at end of file +end diff --git a/lib/middleman-blog-authors.rb b/lib/middleman-blog-authors.rb index 751be52..2ad6276 100644 --- a/lib/middleman-blog-authors.rb +++ b/lib/middleman-blog-authors.rb @@ -4,6 +4,8 @@ class BlogAuthors < ::Middleman::Extension option :author_path, "authors/:author.html", "Path to the individual author pages" option :author_template, "author.html", "Template for the individual author pages" + option :per_page, 100, "Posts to show per page" + option :page_link, "page/{num}", "Path for pages" expose_to_application blog_authors_options: :options expose_to_application blog_authors_data: :blog_authors_data attr_reader :blog_authors_options @@ -26,6 +28,10 @@ def after_configuration ::Middleman::BlogAuthors::AuthorPages.new(@app, self), false ) + + require 'middleman-blog/paginator' + @paginator = ::Middleman::Blog::Paginator.new(@app, self) + @app.sitemap.register_resource_list_manipulator(:blog_authors_paginate, @paginator) end helpers do