Cùran's life
A Debian Developer's observations

2nd March 2011 16:20 (GMT)
Embedding license information in a XHTML-valid way

When you want to offer creative work, or at least your blog posts, under a license which gives the receivers a lot of freedoms, you'll sooner or later come across the Creative Commons licenses. And after you've selected a license of your liking, you'll be presented with a little XHTML snippet. Nice. What's not so nice is, that you'll break the validity of your website as soon as you put that snippet somewhere on your homepage. What to do?

Easy. Ask the W3C for help (ok, don't call them, just use a search engine). Since Tim Berners-Lee is promoting the semantic web for some time now, there must be some conformant way to add the information, which hopefully is also supported by standard-compliant browsers. The answer is a W3C recommendation. The recommendation talks only about XHTML 1.1, but there's also a XHTML 1.0 DOCTYPE (If you don't care about IE, you can use the XHTML 1.1 variant, at least the last time I checked, IE failed miserable with XHTML 1.1. Admittedly, it has been a while since I looked this up.). Just put:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

at the top of your document. Depending on what RDF namespaces you want to use (and how often), you can add more namespaces than the default one to your html tag. So a template for a "XHTML 1.0 + RDFa" document might look like:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:cc="http://creativecommons.org/ns#" xml:lang="en">
    <title>An XHTML 1.0 + RDFa standard template</title>
    <meta http-equiv="content-type" 
      content="text/html;charset=utf-8" />

     <p> Your HTML content here </p>
     <p><span href="http://purl.org/dc/dcmitype/Text"
       property="dct:title" rel="dct:type">[Website Title]</span> by <span
       property="cc:attributionName">[Author's Name]</span> is licensed under
       <a rel="license"
         Commons Attribution-ShareAlike 3.0 Unported License</a> unless
         noted otherwise.

When you're finished, you can start adding licensing information (and other relations) to your website as this little blog is doing.

Permalink | creativecommons, licensing, meta, xhtml.

Common Blog License: Creative Commons Attribution-ShareAlike 3.0 Unported License | Imprint (Impressum) | Compiled with Chronicle v4.6


Support my Debian work!