Wyam2 / wyam

A modular static content and static site generator written in .NET. Fork of Wyam project.
https://wyam2.github.io/
MIT License
6 stars 1 forks source link

Folder API has no effect #14

Open savornicesei opened 3 years ago

savornicesei commented 3 years ago

Issue by aateeque Thursday May 28, 2020 at 14:11 GMT Originally opened as https://github.com/Wyamio/Wyam/issues/14


I have a folder structure as follows:

|-
|--/src
|--|--/API
|--|--/blog
|--|--/products
|--|--/docs

No matter what a put inside that API folder (index.html, docs.md, etc) it doesn't appear in the nav bar in the Docs theme:

image

But if I change the name of that folder from API to anything else it works. It seems like a bug, a user shouldn't have to cater for specially named folders out of the box. But I guess I am doing something wrong, however haven't been able to figure out what.

savornicesei commented 3 years ago

Comment by daveaglick Friday May 29, 2020 at 19:57 GMT


The API folder is special because that's where the results of code analysis go by default so the theme doesn't check for other pages there. While maybe not a bug exactly, I totally agree the reliance on specific folder names isn't great (more on that below).

You can override the default navigation behavior by creating a _Navbar.cshtml file in your "input" folder. For reference, here's the default one: https://github.com/Wyamio/Wyam/blob/develop/themes/Docs/Samson/_Navbar.cshtml. Whatever you put in that file will override the default - so you can copy and paste the current one and then customize it to your needs.

Back to this being a bug/undesired behavior - it likely won't get fixed in Wyam. That's because Statiq is essentially a successor to Wyam (think of it as Wyam v3 + a rebrand). I'm not really doing much more in this codebase. Statiq uses a different folder-agnostic technique for finding files for the themes, so this hopefully won't be a problem there. That said, the docs portion of Statiq isn't ready to go yet so the solution above will hopefully work for you until it is.