Settings

Theme

Ask HN: Why is Amazon's HTML crazy?

9 points by samdunne 13 years ago · 9 comments · 1 min read


If you view the source on any product page you have around 100 lines of whitespace and the <title> isn't found until line 3,500-ish

Not to mention all of their CSS is inline

Why is it like this? It seems to me it is far more complex than it needs to be

gee_totes 13 years ago

How is this crazy?

* Newlines seperating HTML tags (check)

* Semi-semantic class and id names (check)

* Can read it with raw view-source (check)

You wanna see something really crazy? View-source on this one:

https://plus.google.com/101139676677179148632/about?hl=en

rzimmerman 13 years ago

For some reason they have the following comment towards the bottom of the homepage:

<!-- MEOW -->

fadzlan 13 years ago

I would suppose when you see a page from Amazon, there are numbers of the system that contributes to the page. Some with HTML, some with API. And as other commenter mentions, these are all generated by some backend system. Probably no one has to full control on how to format HTML at the front. Or they probably can, but with a lot of meetings.

The store front probably just gather all this stuff to produce the final page that you see.

houjieth 13 years ago

Because they are all legacy code. No one wants to do the cleaning work.

  • brudgers 13 years ago

    More importantly, no one needs to do it.

    And most importantly, no one is allowed to do it because it does not need to be done.

    White space is free as in beer (when all the bandwidth available for AWS is a sunk cost).

    • elclanrs 13 years ago

      Exactly. Don't expect your HTML to be perfectly indented unless you're writing that HTML yourself, but most people don't, an Amazon surely doesn't. The HTML is generated server side.

wcfields 13 years ago

Just took a quick look. I'm guessing they separated it into 20+ linebreaks between chunks to delineate which section of code produced which HTML.

ibudiallo 13 years ago

html is for the browser to read not people.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection