Markdown files in content/home/*.md for page section, but not new pages or posts

I have an index.html file. I want each section to be filled in with content from different markdown files. I don’t want post/pages to be created from the markdown files. Only a simple way to fill in <div> elements in my index.html. Is Hugo the wrong tool for the job?

structure

content/
├── snippets/
│   ├── _index.md
│   ├── snippet-1.md
│   ├── snippet-2.md
│   └── snippet-3.md
└── _index.md

site configuration

[[cascade]]
[cascade._build]
list = 'always'
render = 'never'
[cascade._target]
path = "/snippets/**"

home page template

{{ range where site.RegularPages "Section" "snippets" }}
  <div>
    {{ .Content }}
  </div>
{{ end }}

Thank you! This is great, but it still creates posts. Is there a way to prevent posts from being made in a blog section?

I’m sorry but I don’t understand the question. Can you show me your content tree?

No, no. I’m certain it’s my fault for not being clear/new to Hugo.
Here is the tree.
.
├── _index.md
├── about
│ └── _index.md
├── blog
│ ├── _index.md
│ └── test.md
├── contact
│ └── _index.md
├── home
│ ├── _index.md
│ ├── snippet-1.md
│ ├── snippet-2.md
│ └── snippet-3.md
├── ideas
│ └── _index.md
├── ttr
└── works
└── _index.html

Also, here’s the site. To maybe better visualize what, I’m trying to achieve.

Ok, not sure what this means.

Sorry.
Here. Posts are created from the snippet, but I don’t want that to occur.

I only want to fill out a page with different markdown files providing the content/filling out

s

I don’t want posts from these snippets to appear here:
I only want the markdown files to fill in different divs
within the page

Isnt’ that the same thing we did for the home page? I think we are failing to communicate.

I’m really sorry. This is hard to explain. I could solve this issue by adding partials to the home page, however, partials are in html and not mds. Using md’s creates, on the home page, unwanted posts on the blog page. Is there a way to add content within divs without creating these unwanted posts

With the above, the snippets are not created as HTML files when you build the site.

Site configuration is in a file called config.yaml/toml in the root, correct?

Yes. Perhaps you should share your project repository. I think it would save you some time.

Will do, but I’m not home now. Thank you for your help and patience.

I took a closer look and see that the solution you provided works, but dead links are shown in the blog section.

So, this would help.

Here it is. Thank you

On the blog page, you are listing all the regular pages on the site, regardless of section.
https://git.mgk.quest/mgk/temp/src/branch/master/main/themes/grid/layouts/_default/blog.html#L30

Change this:

{{ range .Site.RegularPages }}

To this:

{{ range .Pages }}

Thank you very much! Solved!

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