Clicking next into pages going from section into subsection

Hello Everyone,
New to Hugo,
I am making a class website. Currently working locally. Here is the content structure for each of my classes
-Content
—Courses
-------Calculus
-----------_index.md
-----------syllabus.md
-----------homeworks.md
-----------gradingPolicy.md
-----------Lessons [folder]
-----------------_index.md
-----------------lesson1.md
-----------------lesson2.md and so on.
-------ComputerScience
-----------syllabus …pattern continues for other classes.

So i’m trying to put Previous and Next navigation on the bottom of pages of each class page. Starting with main Calculus introduction page which is a list page (listing syllabus, homeworks, grading policy). Here the student can click on any one and then…then next → [syllabus]–>homeworks–>gradingPolicy -->lessons list -->lesson1–>lesson2…and so on.

The problem i’m running into is that .NextInSection and .PrevInSection go through Calculus Folder Posts but stop there. I would like it to continue into the subfolder Lessons. At the end of all the lessons, present a link back to main Calculus Page that lists the syllabus,homeworks,and grading policy etc. I am starting to understand a bit of templating logic seeing themes but don’t understand enough to set up conditionals and correctly use all the hugo variables.

here is the the navigation style … let’s say i’m at the Homeworks page

Prev - Syllabus-------------------HOME----------------------Next - Grading Policy

HOME button is also a bit of a problem in the sense that I would like it to go to Main Calculus page _index.md when i’m in the Calculus section and go to Lessons List page when I press it from within lessons page.
Any help appreciated.

You will have a hard time getting answers if you ignore how to request help.

First of all give your text some markdown love and format the code. But I would really say for an issue of this size it would be better to have the repository somewhere online. Doesn’t need to be the full content, just the file structure so we could play around with your templates to see what works.

If I would have to solve this task, I would use a different structure in your content folders. You need to read up about “Page bundles” in the docs. If you change “content/courses/calculus/_index.md” into index.md (no underscore) Then the whole folder calculus becomes a page bundle. Then NO subfolder is allowed to have an _index.md. Rename it into something more useful like introduction.md.

Then all you have is “Page bundle calculus” you could (not tested, but should work) create a navigation in your layout with the following (not the default pagination way, I’d say that won’t work inside of a page bundle):

{{ range .Page.Resources.GetMatch "*.md" }}
  nav item
{{ end }}

Add a weight parameter to your frontmatter in all markdown files so that you can sort sort your navigation.

Edit: There are some documentation and online class themes in the theme directory. Have a look how they did it? Most of them work with sections as courses (or navigational units).

Thank you so much, I just read the forum guidelines properly. I will be setting up a repo for future posts and understand the need for clarity via formatting and including code. Currently, I’m creating everything from scratch…even my custom theme and trying to get to a version that has final structures that I would stick with.

I had not considered other folder structures. I was thinking of keeping lessons separate and organized. I will research and test this out. This gives me quite a bit to go on.

One more question, what would be the best way to include pdf files or powerpoints. My current solution is a folder in static/courses/calculus. This was the only way I was able to make the file links work. Other thought was content/courses/calculus/files. In either case I don’t want the entire folder to be accessible from the internet. Only the individual links within the lessons would open downloadable file.

Put them inside of the page bundle if they belong to one single course. Put them into static if they should be available on more than one page.

The whole “entire folder accessible to the public” is something that you need to configure from the servers side. I am pretty sure that most servers these days are configured to prohibit showing folder content. But that really depends on the specific server.