This page represents a collection of experience-based thoughts and lessons I have collected on my adventures in web development.
Canonical Header Link
If your site has identical or vastly similar content that’s accessible through multiple URLs, this link provides you with more control over the URL returned in search results.
See the Google Webmasters page for more info.
<link rel="canonical" href="http://www.example.com/product.php?item=swedish-fish" />
This can be a very useful tool to speed-up load time, but be sure you understand and thoroughly test all applications running with it. It has great power and can cause some unexpected results.
A project I was working on was using mod_pagespeed and it was discovered that it was stripping the type=”text” attribute from input elements, which is technically okay, because input fields with no type parameter default to a text type field. Unfortunately the CSS was using input[type=”text”] to target textfields styles. It took way longer than it should have to track that down.
It is my opinion that writing shorthand code should be avoided at all costs, especially with PHP.
Shorthand may save a few key strokes but it can also obfuscate important concepts in-code for future developers inheriting your project, check out this article for a nice example of this.
Another concern is that most Apache packages have shorthand turned off by default for PHP, and I have run-in to situation where applications written in shorthand need special server configurations made to simply run.
Code Validation VS Compatibility
It is highly recommended that you run all your markup and CSS through a validator to make sure it conforms to the proper specs. I would advise due diligence however before relying entirely on code which validates, but which may not conform to current usage standards.
An example of this is the new HTML5 document structure in which H1 tags can be repeated throughout the page as long as they are contained within sectioning elements like the article and section tags. A page built in strict HTML5 with multiple H1 tags will validate, but in practice, many screen readers and other syndication applications still rely on the old XHTML heading hierarchy, meaning your content may be read incorrectly, penalizing your page rank in search ratings or causing other information structure problems.
Long story short, Varnish is a little hard to set up but totally worth it.