Each stack overflow post has the following structure:


Does that mean that the post title is an actual html page stored on the server? Or is the body of the post kept and then inserted into a default html page with the header information and sidebars etc?

What does the id part represent? Is this unique for each question?

  • The title part of the url is irrelevant and is only there to make the site more user & search engine friendly. You can go to any question by just providing the ID. – Niklas Jun 6 '11 at 18:39
  • @Niklas thats useful to know. But as @answered mentioned, how are the pages/posts generated? – Santiago Jun 6 '11 at 18:52
  • See: meta.stackexchange.com/questions/10369/… – fretje Jun 6 '11 at 19:02
  • note that the title is ignored and only the ID matters (I put a way better question title on this question's URL): meta.stackexchange.com/questions/94042/… – Daniel DiPaolo Jun 6 '11 at 19:07

I'm nearly certain that the pages are generated dynamically and that the information lives in a database somewhere. Static pages for posts would be absurd to maintain. ID is going to be a unique identifier of some kind, yes.

Think of it like this:

<<incoming request - contains ID>>

  $postBody = $dbconnection.query(POSTS_BY_ID, ID);

  echo '<body>';

  echo $postBody;

  echo '</body>';

Obviously, there's a lot left out here, but the idea is that the post content can be quickly retrieved by ID, then dropped into the page template.

  • @answered so you think that the information is saved maybe as an object in a DB? The object could then maybe loaded into a html template which is generated on the fly? Just trying to get my head around this. – Santiago Jun 6 '11 at 18:47
  • 1
    @Santiago - Most definitely. The contents of the post live in a column, are retrieved by id when the request comes in, and the page is generated dynamically using the values looked up. I'll add some pseudo-code shortly. – g.d.d.c Jun 6 '11 at 18:51
  • @Santiago here is an MSO question giving some information about the technology that powers StackOverflow, if it is of interest to you. – David Z Jun 6 '11 at 23:18

You might want to read up on ASP.NET MVC routing schema.

ID is the question ID in the database, the name is ignored.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .