Minimal site with section listings

Good Sunday evening!

I created a minimal site with:

tree content/tips/
content/tips/
├── bar
│   └── test2.md
├── foo
│   └── test1.md
└── _index.md

But public/tips/index.html is not rendering et al. What am I missing?

(ins)[hendry@t14s testing]$ hugo --disableKinds=taxonomy,taxonomyTerm,RSS,sitemap
Start building sites …

                   | EN
-------------------+-----
  Pages            |  5
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  0
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  0
  Cleaned          |  0

Total in 22 ms
(ins)[hendry@t14s testing]$ find public/
public/
public/index.html

https://s.natalian.org/2020-12-06/tips-listing-missing.zip

Thank you in advance, I’m on Arch with v0.79.0/extended btw

My end goal is to have a listing like https://til.simonwillison.net/

What’s in _index.md? Anything looking like it’s a draft or created by a layout that does not exist?

(ins)[hendry@t14s a]$ curl -sO https://s.natalian.org/2020-12-06/tips-listing-missing.zip
(ins)[hendry@t14s a]$ unzip -p tips-listing-missing.zip content/tips/_index.md
---
Title: Tips
---

Isn’t that sufficient?

patrick@bookra:/dev/pts/1>~/Projects/dnb-hugo
[09:24:39][patrick@bookra] ~/Projects/dnb-hugo (+1|%0|!16877|0)
❯ curl -sO https://s.natalian.org/2020-12-06/tips-listing-missing.zip
patrick@bookra:/dev/pts/1>~/Projects/dnb-hugo
[20:03:11][patrick@bookra] ~/Projects/dnb-hugo (+1|%0|!16878|0)
❯ unzip tips-listing-missing.zip 
Archive:  tips-listing-missing.zip
  inflating: Makefile                
   creating: public/
  inflating: public/index.html       
   creating: resources/
   creating: resources/_gen/
   creating: resources/_gen/assets/
   creating: resources/_gen/images/
  inflating: config.toml             
   creating: themes/
   creating: data/
   creating: static/
   creating: archetypes/
  inflating: archetypes/default.md   
   creating: content/
   creating: content/tips/
 extracting: content/tips/_index.md  
   creating: content/tips/bar/
  inflating: content/tips/bar/test2.md  
   creating: content/tips/foo/
  inflating: content/tips/foo/test1.md  
  inflating: content/index.md        
   creating: layouts/
   creating: layouts/_default/
  inflating: layouts/_default/list.html  
 extracting: layouts/_default/single.html  
patrick@bookra:/dev/pts/1>~/Projects/dnb-hugo
[20:03:18][patrick@bookra] ~/Projects/dnb-hugo (+1|%0|!16879|0)
❯ hugo
Start building sites … 

                   | EN  
-------------------+-----
  Pages            | 10  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 144 ms
patrick@bookra:/dev/pts/1>~/Projects/dnb-hugo
[20:03:22][patrick@bookra] ~/Projects/dnb-hugo (+1|%0|!16849|0)
❯ ls -al public/
total 28
drwxr-xr-x  4 patrick patrick 4096 Dec  6 20:03 .
drwxrwxr-x 28 patrick patrick 4096 Dec  6 20:03 ..
drwxrwxr-x  2 patrick patrick 4096 Dec  6 20:03 categories
-rw-rw-r--  1 patrick patrick   98 Dec  6 20:03 index.html
-rw-rw-r--  1 patrick patrick  707 Dec  6 20:03 index.xml
-rw-rw-r--  1 patrick patrick  438 Dec  6 20:03 sitemap.xml
drwxrwxr-x  2 patrick patrick 4096 Dec  6 20:03 tags
patrick@bookra:/dev/pts/1>~/Projects/dnb-hugo
[20:03:45][patrick@bookra] ~/Projects/dnb-hugo (+1|%0|!16850|0)
❯ 

I can do CLI too :slight_smile:

It creates categories and tag pages, but not the tips section and not the posts in tips itself. So something else might be weirdly set up. Let’s wait until someone else has a look (pinging @jmooring who has eagle eyes for these kinds of things).

Here is the issue:

YOU CAN’T HAVE A FOLDER WITH index.md and further inside of that folder a _index.md.

Having an index.md is always the last markdown part of your file structure. Only _index.md files can have page-bundles further down the line.

content/index.md must be content/_index.md

I am not in front of a computer right now, but can test in an hour. Try renaming it. Might solve it all.

1 Like

No difference!

(ins)[hendry@t14s testing]$ ls content/tips/index.md
content/tips/index.md
(ins)[hendry@t14s testing]$ hugo --disableKinds=taxonomy,taxonomyTerm,RSS,sitemap
Start building sites …

                   | EN
-------------------+-----
  Pages            |  5
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  0
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  0
  Cleaned          |  0

Total in 19 ms
(ins)[hendry@t14s testing]$ find public/
public/
public/index.html

I find it frustrating that hugo says its built 5 pages when there is only one in the public/ dir.

├── content
│   ├── _index.md
│   └── tips
│       ├── bar
│       │   └── test2.md
│       ├── foo
│       │   └── test1.md
│       └── _index.md

This works. If not, run hugo and not hugo --lotsofparameters

And it says 5 pages because overview pages (for instance for the tags) will also count. It did in both cases (wrong index.md file name and proper file name) tell me it created 10 pages. Weird indeed.

Check the table in that page, especially the 4th row :slight_smile:

Sorry, i don’t understand how to get my content/tips rendering out into public/

@hendry

A video reply! Now that’s a first in this forum.

However I humbly request that you refrain from posting external videos with recorded replies as these may be removed in the future and forum topics will end up being incoherent with part of the discussion missing.

Thanks.

P.S. I’ll have a look at that ZIP file and let you know once I see what’s going on.

In the above provided ZIP the tree under the contentDir is the following:

├── content
│   ├── index.md
│   └── tips
│       ├── bar
│       │   └── test2.md
│       ├── foo
│       │   └── test1.md
│       └── _index.md

With this setup the entire contentDir has been converted into a leaf bundle.

Basically /tips/ and its children are now accessible as .Resources.ByType "page" i.e. they are Page Resources of the homepage i.e. /content/index.md.

To make /tips/ a publishable Hugo section you need to rename:
/content/index.md --> /content/_index.md
as @davidsneighbour already pointed out.

Also under the project’s layouts folder you currently have:

layouts
└── _default
    ├── list.html
    └── single.html

In these files you are using Base Templates yet you have not specified a layouts/_default/baseof.html hence your project’s pages render empty.

Please have a look at the relevant articles in the Hugo Documentation and provide the missing template so that your project’s pages are rendered.

1 Like

Thank you! So IIUC, before I accidentally created a “leaf bundle” instead of a “branch bundle” and hence I got a bit stuck!

I’ve added a baseof.html and now upon tips/ I have a listing like:

And what I want instead is:

I’m guessing I need to modify

<ul>
{{ range .Pages }}
<li><a href="{{.RelPermalink}}">
{{ $alternate_title := replace .File.BaseFileName "_" " " | title }}
{{ .Title  | default $alternate_title }}
</a></li>
{{ end }}
</ul>
{{ end }}

But I am not sure how. Wish https://gohugo.io/content-management/sections/ had an example.

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