Dynamically Changing HTML Page Title


I am designing a website where I use PHP as my server-side language. I have a “head.php” file that contains everything that goes in between <head></head>. The problem is, now every file has the same page title. How do I change this for:

  1. Static Pages: Login, Sign up, Home page, etc
  2. User generated pages which will have the title collected from the users themselves

(I don’t have any php in the “head.php” file so saw no need to share the code.)

Thanks :slight_smile:

Uhm, i’m not sure if i’m getting the problem ^^

Could this be helpful? MDN - Document.title

I mean, the content in the <title> tag in the php file will be displayed in every file it’s included in. So If I say “Title 1”, every page that references this php file has the same “Title 1” as their page title.