Why include navigation in config.toml

Hi. I see that you can easily include the nav in the header.html without the need to template it and configurating it in config.toml… Can you tell me why we should do this?

The same reason you use a CMS - you can always do the raw html for any given webpage, of course, but having your content be configurable/editable without having to worry about breaking code makes for an easy life.

1 Like

So Not a real reason then. Since header.html is a partial and it could be written once and used everywhere … in this particular case I find templating and tomling redundant.
I see this as a matter of personal taste … because I can more easily change the nav HTML itself rather than doubling my work for sake of a CMS-like experience…

If that is your personal project then of course you can do as you see fit.

For projects that may be handed down to others in the future, perhaps you should consider using a structure that will make editing easier. The menu table in a project’s config serves that purpose.

2 Likes

Another point: A hard coded nav will be equally rendered on every page—unless you make use of a lot of if conditions.

A nav rendered from your config file can have a current class for the current page. Or the menu item for the current page can be left out …

2 Likes

That’s a good point