Skip to content

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

Open

Description

@yacoob

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? :)

Activity

  1. yacoob commented on Sep 3, 2014

    @yacoob
    ContributorAuthor

    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 :)

  2. spf13 commented on Sep 3, 2014

    @spf13
    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?

  3. yacoob commented on Sep 4, 2014

    @yacoob
    ContributorAuthor

    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?

  4. spf13 commented on Sep 4, 2014

    @spf13
    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

  5. spf13 commented on Oct 19, 2014

    @spf13
    Contributor

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

  6. added this to the v0.13 milestone on Oct 19, 2014
  7. self-assigned this
    on Oct 19, 2014
  8. modified the milestones: v0.13, v0.14 on Feb 22, 2015
  9. modified the milestones: v0.15, v0.14 on Sep 16, 2015
  10. added this to the v0.16 milestone on Nov 30, 2015
  11. 216 remaining items

  12. added this to the v0.129.0 milestone on Jun 21, 2024
  13. modified the milestones: v0.129.0, v0.131.0 on Jul 22, 2024
  14. modified the milestones: v0.131.0, v0.133.0 on Aug 9, 2024
  15. modified the milestones: v0.133.0, Unscheduled on Aug 29, 2024
  16. raoulb commented on Oct 3, 2024

    @raoulb
    Contributor

    Any updates on this? What are the current plans to get archives (without workarounds)?
    Especially as #6992 was closed with reference to this issue here.

  17. github-actions commented on Sep 2, 2026

    @github-actions

    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.

  18. xndvaz commented on Oct 13, 2026

    @xndvaz
    Contributor

    The content-adapter module linked above already provides year/month/day archive pages, with a preliminary hugo list published step. That seems worth treating as the baseline rather than introducing a parallel archive implementation.

    Is generating these archives directly from existing site pages, without that preliminary step, still the intended remaining scope of this proposal? Content adapters currently cannot access built page collections, so removing the step appears to require a lifecycle/API decision.

    Before proposing code, could we clarify whether the preferred direction is a template-driven mechanism along the lines discussed earlier, or documenting the module-based approach? I would keep date-based previous/next navigation (#6992) separate from the initial scope.

  19. jamietanna commented on Oct 28, 2026

    @jamietanna
    Contributor

    I've used the Content Adapter to create date-based pagination pages for my Hugo website ( https://gitlab.com/tanna.dev/jvt.me + https://gitlab.com/jamietanna/www.jvt.me-theme) and it works really nicely, so we do at least have a way to do this as of recent Hugo versions

  20. xndvaz commented on Nov 6, 2026

    @xndvaz
    Contributor

    @bep given the content-adapter solutions shared here, do you see a remaining core feature worth pursuing in this proposal, or would documenting the adapter-based approach be the more useful contribution? I'd like to clarify the intended scope before proposing code.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions