Link sites together?

Let's take https://www.hackster.io/, right? This Projects/Videos/Contests... navbar, when you click on the buttons, it takes you to - where? is it another HTML site? or is it like hidden content on the main site?. - doesn't matter for now. The main question is, how to achieve this one way or another?

I can make navbar button redirect me to another HTML site, but that's about it. Obviously, I don't want to just copy/paste HTML code from site1 to site2 every time I make any change, so can I somehow refer to site1s HTML like with CSS, but change the site content to be the one of site2?

<div class="dropdown-content">
    <h3 style="margin: 0">
    <a href="folder/site2.html">Site 2</a>
</div>

I expect to click button site2 on site1, and site2 should look exactly like site1, have the same navbar, but with different content

EDIT: Ok, another try to explain myself - take stackoverflow homepage. You click on "Users". You get to a page with the same layout and links as stackoverflow homepage, but the content is Users right? This is what Im trying to achieve