I think this problem perpetuates because despite the numerous answers, the environment a novice coder is working in is several layers beyond their experience. It is cool to work inside of such and encapsulated environment until you have to work around that environment.
HTTP is how a website serves content to the world. This usually means a file system and directory in that file system with the HTML, CSS, Images and other media, and a web service such as Apache2 or similar handling the incoming HTTP requests and making the file system access to respond to the requests with the appropriate resource.
This is a stateless system, as the pages are static and never change. Except we can add PHP (hypertext pre-processing) to change the content of the HTML before responding...
Now, we are not talking about an Apache cloud-hosted virtual machine, but a ESP8266.
So, what is the operating system? What is the file system? What is the Web Service? How do we do hypertext preprocessing?
If you want to do everything inside the ESP8266, which is fully doable, those are the questions that need answers.
What is the operating system? I'd suggest using FreeRTOS.
What is the file system? well, we can have one, or we can handle incoming HTTP requests by directly parsing a response in code or using strings etc.
What is the Web Service? again we can handle incoming HTTP requests in various ways.
How do we add dynamic content? We change the way we handle incoming HTTP requests.
How I do it, is I use a file system and RTOS, and in my HTML files, I use comments where I want my dynamic content to be. As I am parsing the file, in my preprocessing, I replace the comment in my response with a response from either a function call or an atomic variable.