# Can't add archive page

**URL:** <https://discourse.gohugo.io/t/cant-add-archive-page/54841>\
**Category:** support\
**Tags:** pagination\
**Created:** [May 23, 2025, 3:51am UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841 "2025-05-23T03:51:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datwins](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Datwins](https://discourse.gohugo.io/u/Datwins)\
**Post date:** [May 23, 2025, 3:51am UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/1 "2025-05-23T03:51:20Z")

</div>

Here’s my github repository:

> **[GitHub - DatWins/learninghugo: learning hugo](https://github.com/DatWins/learninghugo)**
>
> learning hugo

I am using this zwbetz’s make-a-hugo-blog-from-scratch to teach myself about hugo.

I have configured the config file and added categories.

I am working on archives page. I am stuck here

Based on research, I have added archive.md under content/archive.md

Also, I have added layout/archive/archive.html.

But the Archive page is still empty.

Where did I go wrong? Thankyou in advance.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [May 23, 2025, 6:55am UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/2 "2025-05-23T06:55:15Z")

</div>

You mix up taxonomies and ranging over grouped pages.

you defined a taxonomy `archives` but

- none of your pages is assigned to that category.
- so the categories page at `/categories/archives is empty (where your menu is pointing too)
- this is rendered by your `term.html`

your `content/archive.md`

- is rendered to `/categories/archive/index.html` (you don’t have a menu for that)
- this is rendered by `archive/single.html`
- this will show nothing, because your layout ranging is incorrect

```auto
   {{ $type := .Params.archivetype }} This is undefined
   {{ range (.Site.RegularPages.GroupByDate "2006") }} This gets your page groups
      {{ $posts := (where .Pages "Type" $type) }} This gets nothing because $type is unset
      ... # did not check stuff below

```

* * *

the guide is rather old so I used hugo 0.128.1

---

<div class="post-metadata">

**Author:** ![tyco](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tyco/32/23754_2.png) [@tyco](https://discourse.gohugo.io/u/tyco)\
**Post date:** [May 23, 2025, 7:33am UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/3 "2025-05-23T07:33:55Z")

</div>

@Datwins that guide [Make a Hugo Blog From Scratch | Zachary Betz](https://zwbetz.com/make-a-hugo-blog-from-scratch/) is indeed old and doesn’t utilise the current features of Hugo.

I would suggest you run either of these two commands to see and study the files generated by Hugo.

1. This generates a theme inside the themes folder with content and layouts

```auto
hugo new site quickstart
cd quickstart
hugo new theme quickstart-theme
echo "theme = 'quickstart-theme'" >> hugo.toml
hugo server

```

1. This generates the layouts and content at the site root.

```auto
hugo new theme quickstart --themesDir .
cd quickstart
hugo server

```

---

<div class="post-metadata">

**Author:** ![Datwins](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Datwins](https://discourse.gohugo.io/u/Datwins)\
**Post date:** [May 23, 2025, 1:04pm UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/4 "2025-05-23T13:04:30Z")

</div>

Thank you for your time.

Does it matter if it’s an older version of hugo?

My workflow is simple.

1. Fork repository.
2. Make changes to content.
3. Deploy to netlify. Bam, it does the job.  
I can explain this process to other noobies especially to my grandma who’s doing it to save her recipe.

---

<div class="post-metadata">

**Author:** ![Datwins](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Datwins](https://discourse.gohugo.io/u/Datwins)\
**Post date:** [May 23, 2025, 1:06pm UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/5 "2025-05-23T13:06:33Z")

</div>

Thank you for your time.  
Can you suggest a solution? I will delete the layout/archive folder and the taxonomies.  
I will keep content/archive.md.

Does Hugo provide a code template where I can copy?

All I did was copy and paste the lines that you see.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [May 23, 2025, 1:16pm UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/6 "2025-05-23T13:16:08Z")

</div>

in principle you can stay on older versions. if you dont need the new features or security patches but…one time you will want to.

if you just start, then it might be better to start with the latest version.

with 146+ the template organization got a major rewrite. so some old stuff does not work. and many stuff out there is besed on older versions.

in general copy paste without understanding what and why will somedy break… you will have to spend some time for reading and learning.

if you want an archives page showing a list of pages grouped by year you can:

- remove the archives taxonomy
- rename archive.md to archives.md
- fix the looping

---

<div class="post-metadata">

**Author:** ![Datwins](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Datwins](https://discourse.gohugo.io/u/Datwins)\
**Post date:** [May 23, 2025, 1:50pm UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/7 "2025-05-23T13:50:09Z")

</div>

Thank you for your time and advice. I just want something plain and vanilla. I only need blog, tag, categories, and archives.

I remove the archives taxonomy. Rename \*\* archive.md\*\* to \*\* archives.md\*\*

Now, it shows Jan 1, 0001

How do I fix the looping?

I read that you have to create layout/archives/single.html. Does this do the job? Please point me in the right direction.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [May 23, 2025, 4:00pm UTC](https://discourse.gohugo.io/t/cant-add-archive-page/54841/8 "2025-05-23T16:00:03Z")

</div>

> [@Datwins](#):
>
> How do I fix the looping?

Have look at the docs here [GroupByDate](https://gohugo.io/methods/pages/groupbydate/#article). start simple using one of the examples.

> [@Datwins](#):
>
> I read that you have to create layout/archives/single.html

no need for that. just modify you existing layout.
