SubSubFolders in "Chris Albon" Theme

Hello—Any Help Is Greatly Appreciated.

I am attempting to adopt a theme developed by Chris Albon. I have most of the theme working although I am unable to figure out how to reach the sub-sub-folders within Content. You can see how close I’m getting to it at my GitHub Site. There is a particular code-snippet in Albon’s Theme that controls iterating through all the markdown files and displaying their respective links. The folder structure is as follows:

  • Content
    • machine_learning
      • basics
      • SubFolder2
    • Folder2
      • SubFolder1

The code that I am referring to that controls the parsing of these markdown files is:

{{ range (where .Pages "File.Dir" "in" "/machine_learning/basics/").ByTitle }}
    <li><a href="{{.Permalink}}">{{.URL}}</a></li>

It seems like I can’t get the code to go all the way to the deepest level to list out all the links (in the way that Albon does so in his site although I feel like I am close. My edited version (so far) can be found in my pena-notes repo. Is there something I’m fundamentally missing here that is preventing the code from reaching the deepest level to display the appropriate folder addresses?

This seems to work fine on Albon’s site, who apparently also uses Hugo. The code that Hugo generates are also in my GitHub account [ExportedFiles] — this is what I use to publish the site. It also generates these .xml files that I can’t get rid of.

Please let me know if I should provide any more clarification.

Why not use .GetPage?

  {{ $section := site.GetPage "machine_learning/basics" }}
  {{ with $section }}
    {{ range .Pages }}
      <li><a href="{{.Permalink}}">{{.Title}}</a></li>
    {{ end }}
  {{ end }}

You can configure what output formats to generate. You seem to be explicitly generating them.

Note that your reference site seems to be running Hugo version 0.40.1. The current latest is 0.68.3. Quite a few things have changed in between.

1 Like

@pointyfar This exactly fixed my problem! How fantastic! I’m a beginner so I’m still learning all this stuff. Great insight, I learned a lot just from what you wrote. I appreciate your help very much!

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