There's a Vite plugin that can be used to insert identical HTML on multiple pages without JavaScript. I use it for the navbar and footer:
https://www.npmjs.com/package/vite-plugin-handlebarsFor repeated content where JavaScript is required, I use web components.