[partials] how to getpage the page's filename + a given string)

Hi,
My issue is that I don’t like to use the hierachy:
section_name/_index.md ← content
section_name/ressources1.blabla
section_name/ressources2.blabla

Instead, I name my files name.md (much easier to search for than a _index.md among many others !) and I would like ressources related to that page to locate either in a directory of the same name (so name/) or a directory named name_dir/

But I don’t know of a IsDirectory function, and hugo is confused by the ambiguity of both a regular content page and a directory having the same name, so it doesn’t know which to get the resources in .Pages from.

So I would something like this:

{{with .filename"_dir" |.Site.GetPage}}
<dl>
{{ range .Page.Pages }}
  <dt>
    <a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
  </dt>
  <dd class="markdown-inner">
    {{ default .Summary .Description }}
  </dd>
{{ end }}
</dl>
{{ end }}

What can I write it ?

This is the HUGO way … you have to use the predefined names
little workaround:

section_name/ressources1.blabla/_index.md
section_name/ressources2.blabla/_index.md

please read again

I do not care.
I name my files a way to make them easy to search. The article about technology is named technology.md and I will not name it technology/_index.md just because this time it has some related resources. It would be cumbersome as hell to search for.
I order my content as I need to, not where hugo (or rather developers) thinks I should while having no idea how my mind and habits work.

Something that could do the trick IF it wasn’t so badly implemented, would be writing whevere I want but incorporate those texts through a a {{< content >}} shortcode in whichever _index.md to access that page’s .Content, so that it does reflect the rendered site arborescence as per HUGO’s way.
But the TableOfContent function doesn’t look inside shortcodes.

I need to tell hugo to search resources wherever I tell him to, by changing the argument given to .GetPage, is it possible or not ?

… Or I might simply specify which pages follow in the frontmatter, like this:

{{with .Params.To_read_after }}
	{{ range . }}
    {{ with site.GetPage . }}
      <li>  <dt>
		    <a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
  		</dt>
	  <dd class="markdown-inner">
	    {{ default .Summary .Description }}
	  </dd>
	  </ul>
{{ end }}

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