Stack Overflow page design

From EggeWiki
Revision as of 23:05, 24 June 2009 by Egge (talk | contribs) (New page: == What do the smart people at Stack Overflow put in their HTML pages? == === header === <code> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" >...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

What do the smart people at Stack Overflow put in their HTML pages?

header

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" >

  • Strict html4 - this should make the page look good on all modern browsers. Strict can be a bit difficult to achieve - especially if your pulling in third party content

<title>Develop iPhone app without a Mac? - Stack Overflow</title>

  • For title, they put the most important bit first, and also include the site name at the end.

<link rel="stylesheet" href="/content/all.css?v=3706">

  • CSS - they put everything into one big file and specify a version. I'm not sure if the version number is auto-incremented or manual

   <link rel="shortcut icon" href="/favicon.ico">
   <link rel="apple-itouch-icon" href="/apple-touch-icon.png">

  • The favicon I expected - but I had to read about the Apple Touch icon.

   <link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">

  • Open search is fairly popular these days. I'd expect this on any site with a search feature.

   <script type="text/javascript" src="/content/js/master.js?v=3567"></script>
   <script type="text/javascript">var imagePath = '/content/img/so/';</script>

  • All the JavaScript is in one file - just like the CSS. The image path variable is interesting. With this you could easily repoint your images to a CDN - but why not just include it in the master.js file itself?

   <link rel="alternate" type="application/atom+xml" title="RSS" href="/feeds/question/1041623">   

  • About every page has an RSS feed associated with it these days. I'm not sure how useful feeds on item pages are, but maybe people want to know when questions they've asked are updated.

   <script src="/content/js/question.js?v=3591" type="text/javascript"></script>

  • More JavaScript. I assume master applied to the entire site, and this file only applies to question pages.

   <script type="text/javascript">
       var fkey = "4205033...3179b6";
       var isRegistered = true;
       
       $(function() {
           vote.init(1041623); 
           styleCode();
       });
   </script>

  • Since I'm logged in, I can vote. This minimal JavaScript tells the scripts on the page who I am (I think), and what the question number is.

body

<a href="/questions/1041623/develop-iphone-app-without-a-mac" class="question-hyperlink" rel="canonical">Develop iPhone app without a Mac?</a>

  • The use of rel="canonical" is interesting. This is good SEO practice.

<script src="/Content/Js/editor.js?v=3656" type="text/javascript"></script> <script src="/Content/Js/wmd.js?v=3297" type="text/javascript"></script>

<script type="text/javascript">

   $(function() { editorReady(1); });

</script>

  • load the WMD script when/where it's needed. This should help the page load speed