Add ability to generate per-{year, month, day} archives #448

Open
yacoob opened this Issue Aug 29, 2014 · 18 comments

Comments

Projects
None yet
@yacoob
Contributor

yacoob commented Aug 29, 2014

I'm in process of migrating a blogger based blog to hugo. Compare blogger site to hugo-backed site (source here).

One thing that I'll lose as a result of this migration is an archive of posts (like this one). I don't really care all that much, and I'll most likely replace it with a list of all posts, with a different layout, generated from layouts/section/post.html. I'd like to ask you, however, to consider adding a capability for hugo to generate time-based archives. Such archives would most likely be useful to people who want to preserve their existing archive pages.

It'd generate content under public/<section>/2014/index.html for example, from layouts/post/list.html. It'd need to allow per-section and per-level (yearly, monthly, daily) control. It'd also need to play well with permalinks parameter from config.yaml - I don't really have a good idea how to address that.

Is such feature request a sensible one? :)

@spf13 spf13 added the enhancement label Sep 2, 2014

@yacoob

This comment has been minimized.

Show comment
Hide comment
@yacoob

yacoob Sep 3, 2014

Contributor

An idea for implementation: Generate one index.html file for every level of date-related data present in permalinks from the config file. For example, with:

permalinks:
  post: /:year/:month/:slug

generate

  • /2014/index.html from layouts/section/post.html with .Pages containing all 2014 posts;
  • /2014/01/index.html from layouts/section/post.html with .Pages containing all January 2014 posts.
  • etc.

This should require minimal new logic needed. Some sanity checking might be required, unless we want to allow things like /:month/:year. If you point me to the relevant bit of code where content/*list of pages to be generated is devised, I might give it a try :)

Contributor

yacoob commented Sep 3, 2014

An idea for implementation: Generate one index.html file for every level of date-related data present in permalinks from the config file. For example, with:

permalinks:
  post: /:year/:month/:slug

generate

  • /2014/index.html from layouts/section/post.html with .Pages containing all 2014 posts;
  • /2014/01/index.html from layouts/section/post.html with .Pages containing all January 2014 posts.
  • etc.

This should require minimal new logic needed. Some sanity checking might be required, unless we want to allow things like /:month/:year. If you point me to the relevant bit of code where content/*list of pages to be generated is devised, I might give it a try :)

@spf13

This comment has been minimized.

Show comment
Hide comment
@spf13

spf13 Sep 3, 2014

Contributor

I actually think this should be a bit different.

This assumes the year/month structure that Jekyll and others use.

I would prefer instead to register every directory and maintain a list of children content regardless of if it's using the permalinks structure or not.

This would not only give us what you need, but also support for subsections.

Does that make sense?

Contributor

spf13 commented Sep 3, 2014

I actually think this should be a bit different.

This assumes the year/month structure that Jekyll and others use.

I would prefer instead to register every directory and maintain a list of children content regardless of if it's using the permalinks structure or not.

This would not only give us what you need, but also support for subsections.

Does that make sense?

@yacoob

This comment has been minimized.

Show comment
Hide comment
@yacoob

yacoob Sep 4, 2014

Contributor

It does make sense - the only question in this kind of schema is how do we decide whether or not render an index.html page? A user may simply not want a file there. Should it be generated by default, or should it be generated only if user asks for an index on given level?

Contributor

yacoob commented Sep 4, 2014

It does make sense - the only question in this kind of schema is how do we decide whether or not render an index.html page? A user may simply not want a file there. Should it be generated by default, or should it be generated only if user asks for an index on given level?

@spf13

This comment has been minimized.

Show comment
Hide comment
@spf13

spf13 Sep 4, 2014

Contributor

I think by default. It doesn't hurt to have it and you don't need to link
to it. Plus all directories should have an index on the web if they have
content.

On Wednesday, September 3, 2014, Jakub Turski notifications@github.com
wrote:

It does make sense - the only question in this kind of schema is how do we
decide whether or not render an index.html page? A user may simply not
want a file there. Should it be generated by default, or should it be
generated only if user asks for an index on given level?


Reply to this email directly or view it on GitHub
#448 (comment).

Steve Francia
http://stevefrancia.com
http://spf13.com
http://twitter.com/spf13

Contributor

spf13 commented Sep 4, 2014

I think by default. It doesn't hurt to have it and you don't need to link
to it. Plus all directories should have an index on the web if they have
content.

On Wednesday, September 3, 2014, Jakub Turski notifications@github.com
wrote:

It does make sense - the only question in this kind of schema is how do we
decide whether or not render an index.html page? A user may simply not
want a file there. Should it be generated by default, or should it be
generated only if user asks for an index on given level?


Reply to this email directly or view it on GitHub
#448 (comment).

Steve Francia
http://stevefrancia.com
http://spf13.com
http://twitter.com/spf13

@spf13

This comment has been minimized.

Show comment
Hide comment
@spf13

spf13 Oct 19, 2014

Contributor

I think this is related or the same as #465. Tying them together.

Contributor

spf13 commented Oct 19, 2014

I think this is related or the same as #465. Tying them together.

@spf13 spf13 added this to the v0.13 milestone Oct 19, 2014

@spf13 spf13 self-assigned this Oct 19, 2014

@spf13 spf13 modified the milestones: v0.13, v0.14 Feb 22, 2015

@anthonyfok anthonyfok modified the milestones: v0.15, v0.14 Sep 16, 2015

@anthonyfok anthonyfok modified the milestones: v0.16, v0.15 Nov 30, 2015

@matrixik

This comment has been minimized.

Show comment
Hide comment

@moorereason moorereason modified the milestones: future, v0.16 May 7, 2016

@AriaFallah

This comment has been minimized.

Show comment
Hide comment
@AriaFallah

AriaFallah Jun 30, 2016

Any progress on this or workarounds?

Any progress on this or workarounds?

@kakawait kakawait referenced this issue in kakawait/hugo-tranquilpeak-theme Jul 16, 2016

Merged

Transform hexo template to hugo #2

44 of 44 tasks complete
@vielmetti

This comment has been minimized.

Show comment
Hide comment
@vielmetti

vielmetti Feb 27, 2017

Contributor

Any ideas on this one?

Contributor

vielmetti commented Feb 27, 2017

Any ideas on this one?

@yacoob

This comment has been minimized.

Show comment
Hide comment
@yacoob

yacoob Feb 27, 2017

Contributor

FWIW, I've stopped using Hugo for the site that I wanted this feature for, so I'm muting this bug - don't expect any answers here :>

Contributor

yacoob commented Feb 27, 2017

FWIW, I've stopped using Hugo for the site that I wanted this feature for, so I'm muting this bug - don't expect any answers here :>

@mcliment

This comment has been minimized.

Show comment
Hide comment
@mcliment

mcliment Feb 27, 2017

I'm not a Hugo expert and my templates may have some newbie errors but I managed to make archives work using taxonomies.

Check out this repo: https://github.com/mcliment/f1blog-archived/ -there are taxonomies per year defined in config.toml and in every post there's the corresponding frontmatter information-.

The resulting site is here: http://f1blog.climens.net/ with most of the things I had in Wordpress.

I'm not a Hugo expert and my templates may have some newbie errors but I managed to make archives work using taxonomies.

Check out this repo: https://github.com/mcliment/f1blog-archived/ -there are taxonomies per year defined in config.toml and in every post there's the corresponding frontmatter information-.

The resulting site is here: http://f1blog.climens.net/ with most of the things I had in Wordpress.

@smakinson

This comment has been minimized.

Show comment
Hide comment
@smakinson

smakinson Mar 8, 2017

Did this one get dropped for good?

I can see how the taxonomy approach would work, but when thinking from a cms point of view I think it would require it to be able to pull the month from the date and add it to the frontmatter without requiring the user to enter redundant data. As well as making sure the config has the needed year taxonomies as time goes on, though I am curious if that part might be able to be done with gulp or something prior to running hugo. I haven't given that any thought just a spur of the moment idea. Anyway, this feature sounds like it was intended to be much more ideal.

smakinson commented Mar 8, 2017

Did this one get dropped for good?

I can see how the taxonomy approach would work, but when thinking from a cms point of view I think it would require it to be able to pull the month from the date and add it to the frontmatter without requiring the user to enter redundant data. As well as making sure the config has the needed year taxonomies as time goes on, though I am curious if that part might be able to be done with gulp or something prior to running hugo. I haven't given that any thought just a spur of the moment idea. Anyway, this feature sounds like it was intended to be much more ideal.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Mar 8, 2017

Member

Did this one get dropped for good?

It isn't like there are a crazy amount of Hugo developers, and we "all" have our priorities.

Member

bep commented Mar 8, 2017

Did this one get dropped for good?

It isn't like there are a crazy amount of Hugo developers, and we "all" have our priorities.

@unusep unusep referenced this issue in nushackers/nushackers-site Jul 19, 2017

Closed

As a user, I want to look through archives of blog posts #52

0 of 3 tasks complete

@matrixik matrixik referenced this issue in MunifTanjim/minimo Oct 13, 2017

Closed

Page with entire blog archive #52

@COLABORATI

This comment has been minimized.

Show comment
Hide comment
@COLABORATI

COLABORATI Oct 28, 2017

serious design limitation

serious design limitation

@stale

This comment has been minimized.

Show comment
Hide comment
@stale

stale bot Jan 26, 2018

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

stale bot commented Jan 26, 2018

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Jan 26, 2018

@mcliment

This comment has been minimized.

Show comment
Hide comment
@mcliment

mcliment Jan 26, 2018

I find this is still a relevant feature that can be tricked with taxonomies but it's important enough to be a feature in itself.
Many users come from blogging platforms (Blogger, Wordpress...) and every one of them have an archive feature that list posts per year/month/day which can be a convenient way to navigate though the blog.

I find this is still a relevant feature that can be tricked with taxonomies but it's important enough to be a feature in itself.
Many users come from blogging platforms (Blogger, Wordpress...) and every one of them have an archive feature that list posts per year/month/day which can be a convenient way to navigate though the blog.

@stale stale bot removed the Stale label Jan 26, 2018

@bep bep added the Keep label Jan 26, 2018

@bep bep modified the milestones: future, v0.36 Jan 26, 2018

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 26, 2018

Member

Thinking out loud here:

  • This isn't related to nested sections (or they are only if you somehow manually assign folders to month, year etc.)
  • I dont't want to create "another thing" in the site config to define some kind of archive tree
  • This on some level related to pagination; "I want to group and create list pages for this selection"
  • Paginators are available for all "node types" with child pages (home page, sections, taxonomy lists, taxonomy terms)
  • Archives could I guess, also be attached to the same noded (most common would be to create an archive below the home page)

Given the above thinking:

  • What if we create a similar lazy setup with some methods on Page: Archive and Archiver.
  • It will group the pages with a function taking the page's publish date, by default possibly "month/year"
  • But make it possible for people to override this in the template: .Archive .RegularPages "some-pattern"

I don't know how to express "some-pattern" in a flexible way, but that sounds solvable.

Member

bep commented Jan 26, 2018

Thinking out loud here:

  • This isn't related to nested sections (or they are only if you somehow manually assign folders to month, year etc.)
  • I dont't want to create "another thing" in the site config to define some kind of archive tree
  • This on some level related to pagination; "I want to group and create list pages for this selection"
  • Paginators are available for all "node types" with child pages (home page, sections, taxonomy lists, taxonomy terms)
  • Archives could I guess, also be attached to the same noded (most common would be to create an archive below the home page)

Given the above thinking:

  • What if we create a similar lazy setup with some methods on Page: Archive and Archiver.
  • It will group the pages with a function taking the page's publish date, by default possibly "month/year"
  • But make it possible for people to override this in the template: .Archive .RegularPages "some-pattern"

I don't know how to express "some-pattern" in a flexible way, but that sounds solvable.

@bep bep modified the milestones: v0.36, v0.37 Feb 3, 2018

@bep bep modified the milestones: v0.37, v0.38 Feb 11, 2018

@bep bep modified the milestones: v0.38, v0.39 Feb 21, 2018

@bep bep modified the milestones: v0.39, v0.40 Apr 9, 2018

@22decembre

This comment has been minimized.

Show comment
Hide comment
@22decembre

22decembre Apr 14, 2018

I am keeping an eye on that as I wish to use it. (I am sad I don't understand much of the code, it's way too abstract to me.)

I am keeping an eye on that as I wish to use it. (I am sad I don't understand much of the code, it's way too abstract to me.)

@bep bep modified the milestones: v0.40, v0.41 Apr 20, 2018

@bep bep modified the milestones: v0.41, v0.42 May 4, 2018

@TotallyInformation

This comment has been minimized.

Show comment
Hide comment
@TotallyInformation

TotallyInformation May 5, 2018

Really hoping you can come up with a simple to use solution for this as I'm finding it a frustration with Hugo which otherwise I'm loving.

The use of a taxonomy is not scalable but the idea of having something similar to pagination would work for me I think.

Apologies that I don't know GoLang so I'm not able to contribute code here.

Really hoping you can come up with a simple to use solution for this as I'm finding it a frustration with Hugo which otherwise I'm loving.

The use of a taxonomy is not scalable but the idea of having something similar to pagination would work for me I think.

Apologies that I don't know GoLang so I'm not able to contribute code here.

@bep bep modified the milestones: v0.42, v0.43 Jun 5, 2018

@bep bep modified the milestones: v0.43, v0.44 Jun 30, 2018

@bep bep modified the milestones: v0.44, v0.45, v0.46 Jul 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment