(Originally posted 2007-12-10.)
Nowadays – actually thenadays 🙂 but more so nowadays – the value of a web page is related to how well structured it is. Well structured from a mashup programmer’s point of view…
As I often say you have to assume that people will want to take your web pages and mash them up in ways you never thought likely. If your web page is hard to navigate, extract material from, etc then people will use other pages and sites as the basis of their mashups. And you will lose traffic / business / kudos or whatever other metric of success you choose to use . Unless it’s obscurity you seek. 🙂
Here are two simple rules I’ve become sensitised to as a Firefox extension author…
id Attributes On “Structural” Elements
id attribute matches.
Not having this attribute gets you into “I want the third entryfield on the page. No wait, it’s moved to be the fourth” territory. Nasty.
But should you apply this to every element on the page? Not necessarily. But you should think about the structure of the page from the mashup perspective. So a major element like the edit field on your page should probably have an id attribute. (This is a real-world example for me as my Firefox extension parses and injects stuff in a suitable entryfield – for a wide variety of pages. All the “not plain text” in this post was injected programmatically by my extension.)
name Attributes on Forms And Form Elements
name attribute. What’s more you can refer to the elements in the form directly (e.g. myDoc.postForm.textField) but again only if the element in question has a
(In fact the value of using the
name attribute extends (in part) to images (
<img> tags) and java applets (
<applet> tags) but the value is rather less. (Navigating to an image and, especially, to an applet is relatively rare.)
These are simple examples of how to make life easy (or difficult). I’m sure there are many more. The bottom line, though, is to make web pages easy to mash up with other sources of data.
But it doesn’t matter… The guidelines above apply in just the same way to these server-side mashup languages. (I’ve just installed PHP on Apache and intend to play around with such mashing up at some point.)