Auto-generation of titles for date-based filenames

A few sections on my site run entirely off date-title files (e.g. 2020-09-28-<date_rendered>.md), as blogs of a sort. (<date_rendered> is date in a more human-readable format, e.g. sep-28-2020.) These files receive automatic date attributes within Zola because they start with a formatted date.

What I was wondering is: would it be possible to also add automatic title attributes from the files’ dates if their TOML contains none? Ultimately, the file I made an example out of will be available as /<date_rendered>/ (or, in this case, as /sep-28-2020/). The “blogs” require no title, except in page title, to let the user know where they are.

Ideally, I’d have the entry page have title to be formatted after deslugified <date_rendered> (“Sep 28, 2020”), without including <date_rendered> in the file name.

In other words, ideally, unless those two attributes have been specified, I’d have the file 2020-09-28.md produce a page that can be accessed via /2020-09-28/ and has the title of “Sep 28, 2020”.

Is that feasible? possible? Could this possibly be set up on my end, without having to dig into Zola’s engine?

Unlikely:

I think this is not the same issue as URL templates. This is just about setting the title of a post if the filename only has the date.
I wouldn’t auto-format the title though because it’s really personal (ie I find YYYY-MM-DD more readable than Sep 8, 2020) so I don’t know if implementing it would solve @Hyperseeker issue.

I would be delighted if I could affect the auto-generated date-based title on a higher level, e.g. with a section setting. It would be great if I could specify how the date is formatted. I know it’s a lot of work for something so minute.

I think it’s a lot of unnecessary work on the user end to have to write out each log entry’s title, especially when all it is is a formatted date of the entry, which is already derived automatically.

If I can figure it out, I’ll might implement it myself if it’s within Zola’s scope.

Some of those issues might be easier handled with a pre-build step where you have a program take very simple blog inputs (outside of content) and transform them into your desired content pages. I’m working on this model with my new Zola site https://zola-blogs.us.

The build program is being written in the new Raku language.

2 Likes

Could you elaborate on the process you’re using? Is this something I could use as a layperson without too much hassle during setup (so much like Zola itself)?

I’m still in the middle of working on the code, but essentially I’m using a document structure outside content where blog authors insert their posts named ‘NAME/yyyy-mm-dd.md’. NAME is an ASCII alias to be registered by myself and it points to a biographical file of data on that author.

If two or more authors have the same date for a post, I will rename their posts to ‘NAME/yyyy-mm-ddThh.md’ based on the actual time of submission. (I will add ‘mm’ if necessary.) Then my Raku program is executed to assign Zola’s weight values increasing from one based on a reverse sort of the datetime values. Then it creates the actual posts into the proper location in the content directory in their final format. Finally, the ‘zola build’ step is executed.

You can look at my progress at https://github.com/tbrowder/zola-blogs.us. After I’m happy with my code I think it should be pretty easy for others to use.

1 Like