Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tracked by #196
yacoob opened this issue Aug 29, 2014 · 34 comments
Open
Tracked by #196

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

yacoob opened this issue Aug 29, 2014 · 34 comments
Labels
Milestone

Comments

@yacoob
Copy link
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? :)

@yacoob
Copy link
Contributor Author

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
Copy link
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
Copy link
Contributor Author

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
Copy link
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 [email protected]
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
Copy link
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
Copy link

Just for example from Wordpress:
https://wordpress.org/plugins/compact-archives/
http://www.wpbeginner.com/archives/

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

Any progress on this or workarounds?

@vielmetti
Copy link
Contributor

Any ideas on this one?

@yacoob
Copy link
Contributor Author

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
Copy link

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.

@asmaier
Copy link

asmaier commented Dec 19, 2023

So in additional to prev/next on each pager...That seems a bit busy to me

You are right. I don't want additional navigation, but instead have a different alternative date based pagination instead of the normal pagination.

@asmaier
Copy link

asmaier commented Dec 21, 2023

@jmooring I found a way how to create the navigation between the date based sections of your example code as I imagined it. I opened a pull request jmooring/hugo-testing#4 . This might not be the perfect code, but maybe it helps to understand better what I want.

@bep bep modified the milestones: v0.122.0, v0.123.0, v0.124.0 Jan 27, 2024
@bep bep modified the milestones: v0.124.0, v0.125.0 Mar 4, 2024
@22decembre
Copy link

Hello.

I have an interest in this issue. I see that solutions are being proposed. Does it means there will be such a thing in the near future ?

Thanks

@bep bep modified the milestones: v0.125.0, v0.126.0 Apr 23, 2024
@bep bep modified the milestones: v0.126.0, v0.127.0 May 15, 2024
@jmooring
Copy link
Member

jmooring commented May 30, 2024

This uses a relatively simple module to create year, month, and day archive pages for one section of a site. The module leverages the content adapters feature introduced in v0.126.0.

The module itself requires v0.140.1 or later.

Example:

git clone --single-branch -b hugo-github-issue-448 https://github.com/jmooring/hugo-testing hugo-github-issue-448
cd hugo-github-issue-448
mkdir -p assets/data
hugo list published > assets/data/published-content.csv
hugo server

Details:
https://github.com/jmooring/hugo-module-archive

Note that this approach relies on the hugo list published command, for which there is no API promise. Although the output of this command is unlikely to change in a breaking fashion, such breakage is a possibility, and may require a change to the module in order to provide forward compatibility.

@bep bep modified the milestones: v0.127.0, v0.128.0 Jun 8, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
@bep bep modified the milestones: v0.129.0, v0.131.0 Jul 22, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
@raoulb
Copy link
Contributor

raoulb commented Oct 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests