Extending grouping functions

Hi,

I’m now working on extending grouping functions discussed at https://github.com/spf13/hugo/pull/443. Here is the repository: https://github.com/tatsushid/hugo/tree/wip/extend-page-grouping-funcs

I added following functions

  • ByPublishDate: Order contents by PublishDate front matter variable
  • GroupByPublishDate(time_format, order): Group contents by PublishDate front matter variable formatted in string like GroupByDate
  • GroupByParam(param_key, order): Group contents by Param variable specified by key argument.
  • GroupByParamDate(param_key, format, order): Group contents by Param variable spceified by key argument and formatted in string like GroupByDate

And I also modified GroupBy function to allow it to receive a method name argument as its first argument. Its main purpose is grouping by Type. Like me, first people try to use Type for grouping and fail and learn using Section instead of it but It’s not straightforward. By the modification, GroupBy can be used with following type functions

  • func() interface{}
  • func() (interface{}, error)

I welcome comments on it. After the discussion, I would like to send PR.