Strugling with chronological blog archive

Hi All,

I’ve read really carefully this post by @alexandros and this is what I have:

# config.toml
[taxonomies]
year = "year"
month = "month"   

[permalinks]
blog = "/blog/:year/:month/:slug/"
year = "/blog/:slug/"
month = "/blog/:slug/"

And I’m not wondering that his is working, my blogpost URL is like DOMAIN/blog/2021/03/whatever/, and while navigating there it’s get properly displayed, so I was glad.

However when I’m navigating to either DOMAIN/blog/2021/03/ or DOMAIN/blog/2021/ all I got is an an almost empty page, the only conent in there:

<pre>
</pre>

I’m having this file structure in my own theme, and assuming this is correct (even DOMAIN/blog list all the blog posts as required and the blog/list.html and _default\year.html (and month.html) are having the very same content.

...
│ layouts
│ │ blog
│ │ │ list.html
│ │ └ single.html
│ │  partials
│ │ │ blog_summary.html
│ │ │ footer.html
│ │ │ head.html
│ │ └ header.html
│ │ shortcodes
│ │ │ bgg.html
│ │ │ email.html
│ │ │ giphy.html
│ │ └ molykonyv.html
│ │  _default
│ │ │ baseof.html
│ │ │ category.terms.html
│ │ │ cvlayout.html
│ │ │ list.html
│ │ │ month.html
│ │ │ rss.xml
│ │ │ single.html
│ │ │ tag.terms.html
│ │ └ year.html
│ │  404.html
│ └  index.html

Could You please help me what am I doing wrong?

You are more likely to receive prompt and accurate assistance if you provide a link to the public repository for your project.

See https://discourse.gohugo.io/t/requesting-help/9132

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

It is not a public repo as of now. However I followed Your advice to set up a test repo, and while at it I have found the reason to my problem :slight_smile:

First in my blog.md archetype I’have wrongly escaped the quote in year: "{{ … and in some imported blogposts I thought I colud also use this in the frontmatter:

year: \"{{ dateFormat "2006" .Date }}\"
month: \"{{ dateFormat "2006/01" .Date }}\"

However ther right way to do this should have been:

year: "2019"
month: "2019/02"

So same sed˙saved the day. I think this can be archived.

archetypes/default.md

+++
title = "{{ replace .Name "-" " " | title }}"
date = {{ .Date }}
draft = true
year = ["{{ now.Format "2006" }}"]
month = ["{{ now.Format "2006/01" }}"]
+++

Thanks @jmooring I’m using this from now on :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.