Show folder contents using _index.md

Hello
I can’t use hugo easily but I like it very much
I am trying to show the contents of a folder using _imdex.md

Example

├── content
|   ├── posts
|   |   ├── _index.md show contents of folder
|   |   ├── post-01.md
|   |   └── post-02.md
|   └── folder
|   |   ├── _index.md show contents of folder
|   |   ├── file-01.md
|   |   └── file-02.md
|   |   └── subfolder
|   |   |   └── _index.md show contents of subfolder
|   |   |   └── file-01.md
|   |   |   └── file-02.md

Thank you all.

I don’t understand your question:

  • What have you tried so far?
  • What isn’t working?

See:
https://discourse.gohugo.io/t/requesting-help/9132

I want to enter a code in _index.md to show the articles in the folder

For example https://domain.com/folder/ instead of https://domain.com/tags/

you added

---
title: text
---
<ul>
{{ range .Pages }}
    <li>
        <a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
    </li>
{{ end }}
</ul>

but it doesn’t work

Sorry for the inconvenience, I’m not good at English

Content files are for content (e.g., markdown), and must be placed in the contentDir, typically content/.

Template files are for template code (e.g., {{ .Title }}), and must be placed in the layoutDir, typically layouts/.

You cannot include template code within a content file.

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