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

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

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}}
{{ range .Page.Pages }}
    <a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
  <dd class="markdown-inner">
    {{ default .Summary .Description }}
{{ end }}
{{ end }}

What can I write it ?

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


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>
	  <dd class="markdown-inner">
	    {{ default .Summary .Description }}
{{ end }}

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