{"action":"created","issue":{"url":"https://api.github.com/repos/itafroma/jekyll-archive/issues/3","labels_url":"https://api.github.com/repos/itafroma/jekyll-archive/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/itafroma/jekyll-archive/issues/3/comments","events_url":"https://api.github.com/repos/itafroma/jekyll-archive/issues/3/events","html_url":"https://github.com/itafroma/jekyll-archive/issues/3","id":27331050,"number":3,"title":"Provide a way to define arbitrary archive types","user":{"login":"itafroma","id":277116,"avatar_url":"https://avatars.githubusercontent.com/u/277116?v=3","gravatar_id":"","url":"https://api.github.com/users/itafroma","html_url":"https://github.com/itafroma","followers_url":"https://api.github.com/users/itafroma/followers","following_url":"https://api.github.com/users/itafroma/following{/other_user}","gists_url":"https://api.github.com/users/itafroma/gists{/gist_id}","starred_url":"https://api.github.com/users/itafroma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itafroma/subscriptions","organizations_url":"https://api.github.com/users/itafroma/orgs","repos_url":"https://api.github.com/users/itafroma/repos","events_url":"https://api.github.com/users/itafroma/events{/privacy}","received_events_url":"https://api.github.com/users/itafroma/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/itafroma/jekyll-archive/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/itafroma/jekyll-archive/milestones/6","labels_url":"https://api.github.com/repos/itafroma/jekyll-archive/milestones/6/labels","id":926582,"number":6,"title":"0.4.0","description":null,"creator":{"login":"itafroma","id":277116,"avatar_url":"https://avatars.githubusercontent.com/u/277116?v=3","gravatar_id":"","url":"https://api.github.com/users/itafroma","html_url":"https://github.com/itafroma","followers_url":"https://api.github.com/users/itafroma/followers","following_url":"https://api.github.com/users/itafroma/following{/other_user}","gists_url":"https://api.github.com/users/itafroma/gists{/gist_id}","starred_url":"https://api.github.com/users/itafroma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itafroma/subscriptions","organizations_url":"https://api.github.com/users/itafroma/orgs","repos_url":"https://api.github.com/users/itafroma/repos","events_url":"https://api.github.com/users/itafroma/events{/privacy}","received_events_url":"https://api.github.com/users/itafroma/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":2,"state":"open","created_at":"2015-01-08T04:13:52Z","updated_at":"2015-01-11T07:34:37Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2014-02-11T08:12:35Z","updated_at":"2015-01-11T07:36:23Z","closed_at":"2015-01-11T07:34:37Z","body":"Currently, JAG hard defines three archive \"types\": all posts filtered by day, all posts filtered by month, and all posts filtered by year. For each archive type, it also hard defines the path and title.\r\n\r\nThis configuration probably covers 80% of the use-cases for archives, but it'd be cool if there was some more flexibility. I mentioned in #1 for example that on my website, the default path pattern suits me (`YYYY/MM/DD`), but I wanted a different date pattern for the archive titles (`Month D, YYYY`).\r\n\r\nI think it'll require a new configuration schema to do this properly. The current `archive` nested mapping will be replaced with a collection of sequences, which each sequence corresponding to an archive type. To give an example, the current hardcoded archive types would be defined like so:\r\n\r\n```yaml\r\narchive:\r\n    - layout: archive\r\n      path: /blog/:year/:month/:day\r\n      title: Blog archive - :year/:month/:day\r\n      exclude: ['projects']\r\n    - layout: archive\r\n      path: /blog/:year/:month\r\n      title: Blog archive - :year/:month\r\n      exclude: ['projects']\r\n    - layout: archive\r\n      path: /blog/:year\r\n      title: Blog archive - :year\r\n      exclude: ['projects']\r\n```\r\n\r\n(The top three could/should be pre-defined as defaults so you wouldn't have to type all that if you just want the 80% use case)\r\n\r\nYou could then customize each type however you'd like: want a different title, but just for the yearly archives? No problem!\r\n\r\nTaking this one step farther, this new schema should allow for arbitrary collections of posts, not just all posts with a simple exclude filter. So `exclude` will become a nested mapping, with two keys—`categories` and `tags`—and will gain a complementary `include` nesting mapping with the same keys:\r\n\r\n```yaml\r\narchive:\r\n    - layout: archive\r\n      path: /blog/:year/:month/:day\r\n      title: Blog archive - :year/:month/:day\r\n      exclude:\r\n          tags: ['hidden']\r\n      include:\r\n          categories: ['blog']\r\n    - layout: archive\r\n      path: /blog/:year/:month\r\n      title: Blog archive - :year/:month\r\n      exclude:\r\n          tags: ['hidden']\r\n      include:\r\n          categories: ['blog']\r\n    - layout: archive\r\n      path: /blog/:year\r\n      title: Blog archive - :year\r\n      exclude:\r\n          tags: ['hidden']\r\n      include:\r\n          categories: ['blog']\r\n    - layout: archive\r\n      path: /projects/:year\r\n      title: Project archive - :year\r\n      include:\r\n          categories: ['projects']\r\n```\r\n\r\nThe logic with the `include` and `exclude` keys would be the following:\r\n\r\n- If `include` is missing, all posts will be included.\r\n- If `include` is present, only posts matching the include criteria will be included.\r\n- `exclude` is resolved after `include`.\r\n\r\nFor example, this would mean only posts in the `blog` category that do not have the `hidden` tag will be present in the archive type:\r\n\r\n```yaml\r\ninclude:\r\n    categories: ['blog']\r\nexclude:\r\n    tags: ['hidden']\r\n```\r\n\r\nOpen question: should the path and title keys only support Jekyll's permalink tokens? There's not a lot of flexibility with them, but they are what everyone knows. Alternatively, it'd be cool to just support whatever Ruby's [DateTime.strftime](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/DateTime.html#method-i-strftime) supports. Maybe do both?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/itafroma/jekyll-archive/issues/comments/69486351","html_url":"https://github.com/itafroma/jekyll-archive/issues/3#issuecomment-69486351","issue_url":"https://api.github.com/repos/itafroma/jekyll-archive/issues/3","id":69486351,"user":{"login":"itafroma","id":277116,"avatar_url":"https://avatars.githubusercontent.com/u/277116?v=3","gravatar_id":"","url":"https://api.github.com/users/itafroma","html_url":"https://github.com/itafroma","followers_url":"https://api.github.com/users/itafroma/followers","following_url":"https://api.github.com/users/itafroma/following{/other_user}","gists_url":"https://api.github.com/users/itafroma/gists{/gist_id}","starred_url":"https://api.github.com/users/itafroma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itafroma/subscriptions","organizations_url":"https://api.github.com/users/itafroma/orgs","repos_url":"https://api.github.com/users/itafroma/repos","events_url":"https://api.github.com/users/itafroma/events{/privacy}","received_events_url":"https://api.github.com/users/itafroma/received_events","type":"User","site_admin":false},"created_at":"2015-01-11T07:36:23Z","updated_at":"2015-01-11T07:36:23Z","body":"Initial support for defining an arbitrary number of separate archives has been added to master. I'm going to split out the more robust filtering and tokenization into their own separate issues."}}