How to use a common header (eg a nav bar) or a footer on multiple html pages

Hello guys, can someone explain how I should proceed to use a common nav bar on multiple html pages, like I don't need to define them, like having their individual mark up and style, I only want 1 mark up and 1 style sheet which could be use.
69 Replies
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
what's your tech stack?
b1mind
b1mindā€¢3mo ago
HTML template languages or a UI framework
Faker
FakerOPā€¢3mo ago
hmmm I'm lost, I only know about simple HTML/CSS/JS... from what I've seen, people use "jQuerry" to do it
b1mind
b1mindā€¢3mo ago
no don't use jQuery thats cursed af šŸ˜„
b1mind
b1mindā€¢3mo ago
Vituum
Small and fast static site generator for Vite
Faker
FakerOPā€¢3mo ago
what do you propose please.. I'm a beginner, I'm kinda lost right now how to do it
b1mind
b1mindā€¢3mo ago
again look up HTML template languages
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
a static site generator is also an option
b1mind
b1mindā€¢3mo ago
Yea things like Astro/11ty
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
and then there's the cursed stuff................
b1mind
b1mindā€¢3mo ago
but they are also using html template languages or their own
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
yup, but they function differently
b1mind
b1mindā€¢3mo ago
11ty I think lets you bring your own but uses Nunjucks by default
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
ive never tried it, but i should
b1mind
b1mindā€¢3mo ago
I still think this is the best modern way I've found to make static sites with html template/preprocessing
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
ive never tried it either
b1mind
b1mindā€¢3mo ago
Parcel is an option but imo its "ez use" just bites you in the arse
Faker
FakerOPā€¢3mo ago
hmm consider this nav bar for example, so what I wanted is when I navigate through another link , say game for eg, this nav bar is also displayed their
No description
Faker
FakerOPā€¢3mo ago
I should use vite to do it ?
b1mind
b1mindā€¢3mo ago
Its note vite This is the time you will want to start to learn stuff like it though. Vite is just the buildtool/dev env
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
and there is a lot of stuff that just uses vite, because vite is good
b1mind
b1mindā€¢3mo ago
Like "back in teh day" you had Gulp and that other one šŸ˜„ Yea Vite is the modern tooling that most everything is using now.
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
gatsby? or whatever it is?
b1mind
b1mindā€¢3mo ago
na gastby is a SSG (for react)
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
there is yarn, but thats just npm+
b1mind
b1mindā€¢3mo ago
pnpm > yarn šŸ˜„
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
webpack?
b1mind
b1mindā€¢3mo ago
yea Webpack now moving to Turbopack
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
or something older?
b1mind
b1mindā€¢3mo ago
oh Grunt was the other one
Faker
FakerOPā€¢3mo ago
how do you guys do to become so good at whatever things you practice šŸ„²
b1mind
b1mindā€¢3mo ago
Gulp and Grunt I'm not good at anyof it just been around awhile LOL
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
well, im just ok at nodejs stuff but working with this stuff everyday will get it all engraved in your mind
b1mind
b1mindā€¢3mo ago
But back on topic the link I sent is away to use html template languages with Vite for MPA static sites. https://vituum.dev/guide/template-engines.html i.e. I use it for Pug and love it
Faker
FakerOPā€¢3mo ago
yep I will have a look ty !
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
there's also svelte, but it is a completely different thing
b1mind
b1mindā€¢3mo ago
Yea once you decide to start using JS UI frameworks you want to look at Svelte(kit)/Vue(nuxt)/React(remix/next) Angular etc. I would only recommend using them if you use their meta frameworks though too (imo)
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
but in short, you're starting to dip your whole hand in a never-ending hole of tools and options
Faker
FakerOPā€¢3mo ago
oh guys I have a question (this is not related to the topic)... you guys are in say web dev for years now, well before the introduction of generative AI like chatGPT, my question is, do you guys use chatGPT? Because, I feel that I use it too much, I learn things but sometimes I don't learn them fast enough or just out of laziness, just write a chatGPT prompt to generate my idea
b1mind
b1mindā€¢3mo ago
I don't use chatGPT but I use others now and then when I just don't have the brain space... Issue is its really bad at giving you crap code/answers. Beyond anything basic or anything that does not have 1000 examples it copied from it is just plain ass "AI" is just coping answers it has not logic or intelligence to help you.
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
if you dont know the language, DO NOT TRUST AI
b1mind
b1mindā€¢3mo ago
Yea like if you need it to explain some code to you? fine its not bad just make sure you check the references.
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
ai is made to be convincingly convincing at giving you something semi-coherent
b1mind
b1mindā€¢3mo ago
Oh it tells you with such confidense šŸ¤£
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
but it may be a load of muffled garbage, or a working script
b1mind
b1mindā€¢3mo ago
when it just makes up shit I've had it make up methods in libraries far to many times to trust it or just make up libs šŸ¤£
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
and when you ask it to correct the script, it hallucinates more than all the people at a rave, combined and since you are new and dont know much of the language, you cant tell whats wrong
b1mind
b1mindā€¢3mo ago
This will go way off topic though šŸ˜‚
Faker
FakerOPā€¢3mo ago
yeah I see, the thing is, I'm currently at university level and the funny thing is in my modules, the module leader said that we can use AI to help us in our coursework, I don't know why they encourage such things and the problem is just to not be "out-paced" by the other students using gen AI I use it but then feel guilty
b1mind
b1mindā€¢3mo ago
lazy ass teacher sorry not sorry
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
use it for boilerplate use it for repetitive tasks use it for formatting
b1mind
b1mindā€¢3mo ago
its so bad at css/html šŸ˜‚
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
use it to translate dont ask it to solve anything, because it usually doesnt
b1mind
b1mindā€¢3mo ago
because most all its examples of html/css are shit so it just repeats the bad practices šŸ˜„
Faker
FakerOPā€¢3mo ago
yeah I see, I need to get rid of that bad habit of using AI now and then
b1mind
b1mindā€¢3mo ago
Use it just don't rely on it, and know better than it.
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
you need to get rid of using ai as a 2nd brain ai is the dumbest you can find
Jochem
Jochemā€¢3mo ago
This. It's a tool, learn its weaknesses, and then use it for its strengths.
Faker
FakerOPā€¢3mo ago
yep I see
b1mind
b1mindā€¢3mo ago
Idk how a teacher would tell someone to use something that is only correct 60% of the time though. that is such bs imo
į¼”ĻĻ‰Ļ‚
į¼”ĻĻ‰Ļ‚ā€¢3mo ago
you're being generous šŸ¤£
Faker
FakerOPā€¢3mo ago
I guess we got off-topic, sorry guys but thanks for the answer, really appreciate I needed to get some advice from experienced person :c
b1mind
b1mindā€¢3mo ago
GL on your html template venture. Make a new post if you have issues with Vituum I don't know it that well but probably can help.
Faker
FakerOPā€¢3mo ago
yep will do so if I struggle, thanks once more !
Edin Durak
Edin Durakā€¢3mo ago
Because, you said you are entry level, the best way would be to add the same navigation elements on each page. Also, you can link every page with css where you style those nav elements. The same goes for every other repeating element.
b1mind
b1mindā€¢3mo ago
that only accounts for the styles not the markup/content html template* languages are a great first step into frameworks and other build tooling You have to make the leap at some point. Every JS/UI framework uses some type/form of them, every Fullstack web framework uses one too. Most really don't differ that much for writing but more how they compile templates/reusables. So when you learn one you can understand others really easy.
Edin Durak
Edin Durakā€¢3mo ago
Agreed I tried a simple way. As if I am at the beginning and all these messages I read, I would be totally confused. If for example, I do not know SaSS/SCSS why talk about more complicated stuff.
b1mind
b1mindā€¢3mo ago
No one mentioned sass šŸ¤·ā€ā™‚ļø just talking about html templating (well and ai rant lol)
Want results from more Discord servers?
Add your server