Hello All! Complete amateur here so please bear with me and my amateurish questions

What I really need to know is how links presented on a web page are automatically changed depending on who is viewing them - for example, on websites such as Ebay and Facebook, whenever you click on a link to an item listing / another member's fb profile, the links you see refer to the creator's username (ie. "View xxxxx's Photo's", View xxxxx's Other Items for Sale"...etc.) However, when the creator of such pages is logged in to the respective websites and they are the one viewing their own profile / item listing, those links change to refer to the viewer as "you / your" (ie. "View Your Photos", "View Other Items You are Selling"...etc.)

Would someone be able to point me in the right direction as to how this is implemented? I'm sure it's something incredibly simple that I just haven't thought about - I have looked into toggling divs but i'm not sure if this has anything to do with what I want to achieve whatsoever...

Thank you very much for any responses given!