Staying valid
2nd May 2004
There seems no automatic way to keep a site valid with web standards unless you close it off to the rest of the world to contribute to it. I will not do that anytime soon.
There is: I’m doing it. Next Thursday will mark the one year anniversary of my switching to application/xhtml+xml as the content-type header for this site, for user agents that support it. Using that content-type forces Gecko engine browsers to refuse to render pages if they are not well-formed XML, so if a page is invalid I hear about it pretty quickly.
So how do you keep a frequently updated site with data from external sources and user comments valid? There are really only two things you need to do. Firstly, ensure that everything going IN to the system (entries and comments) is valid XHTML. I do that using a simple validation system for comments and a bookmarklet for my own entries. Secondly, any and all data from external sources (my blogroll from blo.gs, blogmark URLs added using a bookmarklet) needs to be entity-escaped before being displayed on the site. In my case, a call to PHP’s htmlspecialchars() function is all that’s needed.
I’m not saying my system is ideal—the need for well formed markup in comments is a major usability issue even on a site with an audience consisting mostly of web developers. But it’s certainly possible to operate a site in XHTML with frequent updates and user comments while staying valid at the same time.
More recent articles
- Weeknotes: the Datasette Cloud API, a podcast appearance and more - 1st October 2023
- Things I've learned about building CLI tools in Python - 30th September 2023
- Talking Large Language Models with Rooftop Ruby - 29th September 2023
- Weeknotes: Embeddings, more embeddings and Datasette Cloud - 17th September 2023
- Build an image search engine with llm-clip, chat with models with llm chat - 12th September 2023
- LLM now provides tools for working with embeddings - 4th September 2023
- Datasette 1.0a4 and 1.0a5, plus weeknotes - 30th August 2023
- Making Large Language Models work for you - 27th August 2023
- Datasette Cloud, Datasette 1.0a3, llm-mlc and more - 16th August 2023
- How I make annotated presentations - 6th August 2023