lib/nanoc/toolbox/helpers/blogging_extra.rb
# Enable blog post behavior on all the items located in the post folder(s)
#
# @example
#   # In your config.yaml
#   # post_dirs: [ 'posts' ]
#
#   # In your Rules file
#   preprocess do
#     add_post_attributes
#   end
Enable blog post behavior on all the items located in the post folder(s)
Enable blog post behavior on all the items located in the post folder ( s )
def add_post_attributes
      @config[:post_dirs] ||= ['_posts', '_articles']
      items.each do |item|
        if (item[:filename] && @config[:post_dirs].include?(File.dirname(item[:filename]).split('/').last))
          act_as_post(item)
        end
      end
    end
def add_post_attributes @config [ :post_dirs ] ||= [ '_posts' , '_articles' ] items . each do | item | if ( item [ :filename ] && @config [ :post_dirs ] . include? ( File . dirname ( item [ :filename ] ) . split ( '/' ) . last ) ) act_as_post ( item ) end end end
Enable blog post behavior on all the items located in the post folder(s)
Enable blog post behavior on all the items located in the post folder ( s )
# check the item's parent directory against the post_dirs
example
In your config.yaml # post_dirs: [ 'posts' ] # In your Rules file preprocess do add_post_attributes end
In your config . yaml # post_dirs : [ ' posts ' ] # In your Rules file preprocess do add_post_attributes end