[hugo-0.18+] "Everything is a Page"?

I’ve built a hotsite and I used to use *Hugo-0.16" to render it.

Now I’m trying to update to Hugo-0.18+, but I’m having some problem. I believe the troubles are related to what I understand of the “rule” everything as a page.

According to this rules of Hugo-0.18+ it threat everything as a page (https://gohugo.io/content/using-index-md/) if we use _index.md.

Then I created a sample test site to check, but it doesn’t work (same behaviour of my hotsite).

├── archetypes
├── config.toml
├── content
│   ├── about
│   │   └── _index.md
│   └── _index.md
├── data
├── layouts
├── static
└── themes
    └── ...

What is expected?

The “home” and “about” pages render right.


My workaround:

├── archetypes
├── config.toml
├── content
│   ├── about
│   │   ├── _index.md
│   │   └── index.md
│   ├── _index.md
│   └── index.md
├── data
├── layouts
├── static
└── themes
    ├── ...

I’ve created both files index.md and _index.md:

  • _index.md
+++
date = "2017-04-23T12:21:47-03:00"
draft = false
title = "Home page"

+++

it can have something else
  • index.md
+++
date = "2017-04-23T12:21:47-03:00"
draft = false
title = "Home page"

+++

# Your page with Real Content

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 

Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. 

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.

Is this “workaround” the correct behaviour?

Or can you point me some solution?

I suggest you post a link to the source of your test site.

I suggest you link the theme in as a submodule so people can test it by doing “hugo server”. And I’m not sure what you questions is, but I’m pretty sure that it is theme related, and the theme author may be a better person to ask.

for one of them I’ve already done:

github.com/humboldtux/startbootstrap-clean-blog/issues/28

What theme you suggest me to use that has no problem in rendering site with hugo-0.18+?

Can you explain what you’re attempting to achieve?

content/_index.md will include content and frontmatter for your homepage.
content/about/_index.md will include content and frontmatter for your about section.
So, for the latter, there is an expectation that you will be putting other items within the about section, rather than just one about page.
For just one about page, I’d recommend content/about.md
As mentioned in the below docs page, about/_index.md will be rendered using a list page, whereas about/index.md and about.md will be rendered using single templates.

I think this page of the docs may be of use to you. https://gohugo.io/content-management/organization/#index-pages-index-md

Well,
I’m only trying to serve our hotsite (https://gitlab.com/devops-df/2017.brasilia.devopsdays.com.br) with Hugo-0.18+.

every page works as expect on Hugo-0.17,but it’s “about” page doesn’t work on Hugo-0.18+.

I already tryied mv about/index.md about/about.md and mv about/index.md about/_index.md.

PS: for all tests I’ve done I use 2 updated themes (e.g startbootstrap-clean-blog and mainroad). same behaviour above when using any of these two themes.

Just downloaded your project. Your header.html in both /layouts/header.html and /theme/layouts/header.html has .RSSlinks. Change this to .RSSLinks (note the capital L) and all the pages render.

/about renders for me as detailing information about sponsorship. Is this correct? I’m running Hugo 20.2.
The current master on Gitlab has an index.md file, leading to /about having a title of Abouts. Renaming this to _index.md changes the title to DevOpsDays.

None of the content (etc.) from _index.md is rendering on /about because the list.html template (which /about uses, as it is a list page) does not have any method of doing this. Adding a {{.Content}} in that page makes the content suddenly appear (hooray!). There is code to change the image with your theme, but it doesn’t currently use the page params, it’s hardcoded. You can change this in multiple ways, using isset, default, or an if, else.

1 Like