How to automatically generate site from folder structure?

I want to create a documentation site, using e.g. hextra theme.

At the moment, as a source, I have a bunch of markdown files without hugo front matter, organized into Units and Lessons in the following way:

My goal is to generate a site with the same structure. How to automate that process?
Specifically, generate an appropriate front matter for each of the markdown files that will:

  • inherit the page name from the filename
  • correctly point to “prev” and “next” page
    I would be grateful for any tip on the method to use. I’m a hugo newbie and didn’t have time to study all the docs, so that could have been already solved somehow, but still would appreciate Your advise,


This article might be helpful.

You’ll need to add the navigation elements to your templates, not to the content.

Thanks a lot. I wrote a python script for that, but in case it is not implemented in Hugo yet, from my “newbie perspective” that could be a killing feature… Imagine: with a single click you get the website for multiple folders of nested markdown files. In my case, these are 2 e-learning courses, with app. 90 lectures (markdown pages with YT embed and text/graphics) each.

Many thanks for Your help :slight_smile:


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