List sub-folders

Here is the file structure:

       |      |_
       |       |_

Now, I want to provide like a menu to the subfolders topic1, topic2 from the writeups, but I also want to have an introduction in the writeups page too. I noticed that hugo automatically generated links to these subfolders but I was not able to add any extra content.
I am new to hugo and I need help.

I don’t know what this means. To which page do you wish to add “extra” content"?

Which theme are you using?

Sorry for the confusion. I want to add some content in the /writeups page, basically an introduction, followed by the links to the sub folders.

When i add links in writeups/ as follows:

Some text here ...

- [Topic1](topic1/)
- [Topic2](topic2/)

But when I click on them I get a 404. Despite the folder content/writeups/topic(1,2) having an file.

And i am using hugo-ficurinia

Add content to content/writeups/

When i do that hugo seems to ignore it and justs shows the links to the subfolders. Ill try again though

You are more likely to receive a prompt and accurate response if you post a link to your project’s Git repository.

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 havent yet pushed to github. Give me a minute

mv content/writeups/ content/writeups/
mkdir -p layouts/_default
cp themes/hugo-ficurinia/layouts/_default/list.html layouts/_default/

The last line overrides the theme’s template.

Then edit layouts/_default/list.html:

{{ define "main" }}
    {{ .Content }}
    {{ if in (site.Params.extraContentDirs | default (slice)) .Section }}
        <h1>{{ .Section | humanize }}</h1>
        {{- partial "home_post_list.html" (dict "Ctx" . "AllPostsList" .Pages) -}}
    {{ else }}
        {{- partial "simple_posts_list.html" . -}}
    {{ end }}
{{ end }}

Great. That seemed to work! Could you explain what changed by using and how it automatically lists the subfolders?
Also do i need to do the same in order to list other pages? Not subfolders this time

I will give it a read thanks. About listing individual pages?
For example:

|___ page1
|___ page2

What’s your question?

Mentioned it in a previous reply. What do I need to do to list individual pages in a similar nature.

Sorry, I still don’t understand your question. Your existing content structure looks fine:

├── about/
│   └──
├── posts/
│   ├──
│   └──
└── writeups/
    ├── pico/
    │   └──
    ├── tryhackme/
    │   └──

Let me try to rephrase. The pico and tryhackme folders will contain multiple pages in the near future. I want their to pose as a navigation page. The writeups will include taxonomies like difficulty/category/os. Is there a way to make list these pages by thejr taxonomies?
Something like:


If you want a directory to be a section (i.e., multiple pages) it either needs to be a top level directory, or it must contain an file (with an underscore).

A directory must not contain both an file and an file.

So just like you did with the writeups directory, you’ll you need to rename some files:

mv content/writeups/pico/ content/writeups/pico/
mv content/writeups/tryhackme/ content/writeups/tryhackme/

Sure. That’s an advanced topic. Please update your repository with sample content that has terms assigned, and we can look at it again.

Alright. I will give you a mention when its done

Hey there! I spent some time reading and I came up with the following shortcode which seems to do exactly what I want! I did not expect it to be relatively easy to make.
Are there any improvements I can make whatsoever? Thanks in advance!

<!-- layouts/shortcodes/taxonomy-list.html -->
{{ $taxonomies := .Get "taxonomies" | default "" }}
{{ $taxonomyList := split $taxonomies "," }}

{{ if gt (len $taxonomyList) 0 }}
    {{ range $taxonomyList }}
        {{ $taxonomy := . }}
        <h2>{{ $taxonomy | title }}</h2>
        {{ range $term, $taxonomyPages := index $.Site.Taxonomies $taxonomy }}
            <h3>{{ $term }}</h3>
                {{ range $taxonomyPages.Pages }}
                    <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
                {{ end }}
        {{ end }}
    {{ end }}
{{ else }}
    {{ range $taxonomyName, $terms := $.Site.Taxonomies }}
        <h2>{{ $taxonomyName | title }}</h2>
        {{ range $term, $taxonomyPages := $terms }}
            <h3>{{ $term }}</h3>
                {{ range $taxonomyPages.Pages }}
                    <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
                {{ end }}
        {{ end }}
    {{ end }}
{{ end }}