Can't load lists or singles in a sub directory

I have ‘content/media/blogs’ and inside those I have an _index.md. Then I created a layout with and singles / list html in both directories.

No matter what I do I’m unable to access the blog content, as it seems that it’s only grabbing the parent directory “media”

To add to this, I’m also trying to grab the selection from the “blogs” {{ $paginator := .Paginate (where site.RegularPages "Section" "==" "blogs" ) }}

pleas read
Content Sections | Hugo (gohugo.io)

Yes, I did.

I’m still not able to access from the sub directory.

@ju52
image
image

And this is the media/blogs/list.html
image

This should read “This is a blog list”:
image

image

do not put the stacked sections in a template tree

Hugo’s Lookup Order | Hugo (gohugo.io)

for better help - please share a (sample) repository

Here’s the repo: wes-kay/hugo_testing_list_children (github.com)

I don’t understand the docs say to do it: Sections | Hugo

Hello @i732

You can simply put the blog folder out of the media folder, it will solve your issue,
Or you can set every post layout=blog and create blog.html in layout/default folder (which is actually your blog/single.html file.

I would but I’m looking for the structure media/blogs in my URL. Anyone know why this isn’t working? Or how to make it work?

then follow this steps

I don’t see how that’s going to give me media/blogs in the url mysite.com/media/blogs.

Correct me if I’m wrong this has nothing to do with the singles.

Also I need to display a the list of items from a section {{ $paginator := .Paginate (where site.RegularPages "Section" "==" "blogs" ) }} I don’t see how your solution is going to solve this, unless I’m missing something.

first of all, duplicate your single.html from the default folder and rename it blog.html

then open your any single-post.md file and give the layout like this

---
title: "your post name"
date: 2018-09-24T11:07:10+06:00
layout: "blog"
draft: false
---

@i732 You are confusing two things here.

Content structure.

As per the docs, content/foo/bar/baz/index.md will give you yoursite.com/foo/bar/baz/

Layout structure.

As per the responses above, create layouts/_default/whatever.html and set layout=whatever in the frontmatter of whatever content you want to use this layout.

I’m back, you can define the public structure with permalinks

ex:

blogs: /media/blogs/:year/:month/:title/

@gethugothemes @pointyfar @ju52

I feel like you’re assuming I am having an issue with the singles when I’m not. I’m trying to access the list of content FROM the directory. This has NOTHING to do with singles.

This is the problem I have a media directory that has a list.html that only contains “This is a list” then I have a sub directory blog folder:

When I go to mysite.com/media/blogs I should see “This is a blog” but I see “This is media”:
image

This has nothing to do with singles content. I need this structure so I can sub directory out content and drive the logic through directories. Is this possible? Or is this a bug?

your repository is mostly empty. The content directory should be in your top project directory etc…

Please read Content Organization | Hugo

here is my sample repo … as example for a hugo project

I read that, I’m sorry but I don’t see why I’m not able to view my list of blog content, from the path /media/blogs the page keeps serving up my /'media list.html

I also put the content folder in the root of my project and the exact same thing. Can someone run the code I uploaded wes-kay/hugo_testing_list_children (github.com) and show me that localhost:1313/media/blogs is displaying “This is a blog” because I don’t see what the issue is.


This tells me that what I am trying to do is not possible. Can you confirm it. All I need is to be able to serve my content from the specified list.html I need to see “This is a blog” from the media/blogs URL.

You’ve pointed me to multiple document pages and none of them are helping and all of them don’t answer my question.

And as we keep trying to tell you, this can be done, but you need to do as instructed.

You can nest your content directory, but you need to put your layout in layouts/_default/whatever.html NOT layouts/media/blog/list.html

layout/media/blogs/list.html will not be used.

Do this exactly:

  1. Create a file at layouts/_default/whatever.html.
  2. Put in this file: Whatever
  3. In content/media/blogs/_index.md frontmatter put in layout: whatever
  4. View localhost:1313

It says right there in your last screenshot:

If you need a specific template for a sub-section, you need to adjust either the type or layout.

This is step 3 above.

If you cannot follow these steps, I don’t think we can help you.

@pointyfar I did exactly what you said:


I also have layout: blogs on the blog-text.md just showed the _index for a quick image.

And I’m still not getting the layout I need: image

Can you do me a favor and pull the repo I uploaded and show me how I can get localhost:1313/media/blogs to show a list of the content I have. Because I don’t see how this is possible with what you’re suggesting. What I understand is you’re telling me how to point the single content to the corrent layout, that’s not what I’m asking, I need the list of content so I can paginate them.

I figured it out using that structure. I need to figure out why this is, I’ll read the source.

Thank you guys for the patience.

Option 1:
Delete the layouts/media/ folder.


Option 2:
Keep layouts/media/ folder, put whatever.html inside layouts/media/ folder.