Jasmine Lognnes
Jasmine Lognnes

Reputation: 7127

Am I using Bootstrap's navbar correctly?

I can't find any info how the intended implementation of Bootstraps navbar is suppose to be done.

Right now I have downloaded the example, and cloned it for each of the button options, changed the menu so the shows the correct selected button, but this can't hardly be the correct way, as it is a lot of copy/paste maintenance.

Also I am guessing that is not the intended method, as it looks like navbar is a class in bootstrap.

Has anyone tried to use navbar and can tell me how they did it, or point me to the intended method?

Upvotes: 0

Views: 53

Answers (1)

d2xdt2
d2xdt2

Reputation: 371

It is outside of Bootstrap's scope how to implement it in an efficient way. That is the job of a server-side language.

When you have a situation where you do a huge copy/paste, then think template, and for small copy/paste think variable like in the case of the menu, where you have to change the active state.

Any modern server-side language have a template engine, where you put in skeleton of your page.

For the menu, you probably want to generate it, where you have the menu button names in a yaml file or perhaps database of some sort.

On the other hand is it popular to offline generate all possible html pages, and then serve them with a plain httpd or nginx. Jekyll and github pages are such examples.

Upvotes: 1

Related Questions