Archetypes/about.md isn't being applied to `hugo new about.md`

Wouldn’t be surprised if I’m just overlooking something obvious. I’m making a simple theme based on minimal-bootstrap-hugo-theme. At first, when I visited http://localhost:1313/about, I would get “Page Not Found”.

I created archetypes/about.md:

---
title: "test"
draft: true
---

Hello

and then created the about page hugo new about.md, but the page just shows

About

February 29, 2024 

Is archetypes/default.md being applied instead? It seemed like it worked a few times, but if I reloaded or restarted the development server or deleted content/about/md and recreated it, it would go back to

About

February 29, 2024 

Any help is appreciated

https://gohugo.io/content-management/archetypes/

You can create an archetype for one or more content types. For example, use one archetype for posts, and use the default archetype for everything else:

“about” isn’t a content type.

Ok, so given what I’m trying to do, should I instead make content/about/_index.md for a default about page?

you can create an archetype for the content type “page” and it will create the frontmatter you need.

if you have archetypes/page.md, it should be used if you run hugo new page/about/_index.md

There seems to be some confusion about archetype vs. content vs. template.

An archetype is a template for new content. Archetypes go in the archetypes directory. Many sites have one archetype they use for everything (the default archetype), while other sites might have two or more archetypes if a particular content type requires additional front matter fields specific to that content type.

Content is created in the content directory. The default front matter is based on the archetype. To create an “about” page at the root of your site, do one of:

hugo new content content/about.md

OR

hugo new content content/about/index.md

Use the second one if you intend to add resources (e.g., images) specific to this content. For example:

content/
├── about/
│   ├── a.jpg
│   └── index.md
└── _index.md

Templates go in the layouts directory, and contain the HTML and template code required to render the page. To create a template that will only be used for the “about” page:

layouts/
└── _default/
    ├── about.html
    ├── baseof.html
    ├── home.html
    ├── list.html
    └── single.html

Then, in the front matter for the “about” page, add this:

layout = 'about'
1 Like

So the biggest difference between using content/about/index.md or layouts/default/about.html is that the latter allows you to use more HTML/CSS/etc? They’re both perfectly acceptable methods?

It’s not an either/or. You must create a content page. Whether you need a template specifically for that page depends on what you’re trying to do.

I encourage you test this on your own. It’s a great way to learn.

I see now, thank you for clarifying

Sorry to keep pestering, but why is /content/about/index.md required? I see that I can create /layouts/_default/about.html and render my info without the content page. Not doubting or anything, just curious as to why it’s standard

A layout without content is useless.

just asking for the sake of understanding hugo :grimacing: Useless how? If I have the following in /layouts/_default/about.html, I see ‘hello’ when I visit https://localhost:1313/about.

{{ define "main" }}
    hello
{{ end }}

Share your repository and I’ll tell you why.

See Requesting Help.

Let us see your code

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.

I did at the top, but it’s here GitHub - jrilez/Logdot: A very basic blog-style theme for Hugo (WIP)

I’m not sure what you’re looking at…

rm -rf public/ && hugo -D --themesDir . && tree public
public/
├── categories/
│   ├── index.html
│   └── index.xml
├── css/
│   └── main.min.653ed8fd370f02a0e6d580cc26d2cea31caaa98b042797dae9f2fe1b1a527aa3.css
├── favicon/
│   ├── about.txt
│   ├── android-chrome-192x192.png
│   ├── android-chrome-512x512.png
│   ├── apple-touch-icon.png
│   ├── favicon-16x16.png
│   ├── favicon-32x32.png
│   ├── favicon.ico
│   └── site.webmanifest
├── js/
│   └── main.23cd0c7d837263b9eaeb96ee2d9ccfa2969daa3fa00fa1c1fe8701a9b87251a1.js
├── posts/
│   ├── welcome-to-logdot/
│   │   └── index.html
│   ├── index.html
│   └── index.xml
├── tags/
│   ├── index.html
│   └── index.xml
├── about_holder.png
├── index.html
├── index.xml
└── sitemap.xml

There isn’t an about page.

Although a bit dated at this point, I found Mike Dane’s tutorials be very helpful as I was getting started.
https://www.youtube.com/watch?list=PLLAZ4kZ9dFpOnyRlyS-liKL5ReHDcj4G3&v=qtIqKaDlqXo

It seems like this might be a better place for you to get started.

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