Add spec name to page titles.
authorCameron McCormack <cam@mcc.id.au>
Mon, 06 Aug 2012 11:49:15 +1000
changeset 41 6b012fac2875
parent 40 8ea7594eead5
child 42 7f26a34bb9e7
Add spec name to page titles.
publish/processing.js
publish/publish.js
--- a/publish/processing.js	Sun Aug 05 22:49:58 2012 +1000
+++ b/publish/processing.js	Mon Aug 06 11:49:15 2012 +1000
@@ -22,6 +22,16 @@
 }
 
 
+// -- Include the specification name in the page's <title> --------------------
+
+exports.insertSpecNameInTitle = function(conf, page, doc) {
+  if (conf.index == page) {
+    return;
+  }
+
+  doc.getElementsByTagName('title')[0].textContent += ' – ' + conf.shortTitle;
+};
+
 // -- Link to the W3C style sheet for the document's maturity -----------------
 
 exports.insertW3CStyleSheet = function(conf, page, doc) {
--- a/publish/publish.js	Sun Aug 05 22:49:58 2012 +1000
+++ b/publish/publish.js	Mon Aug 06 11:49:15 2012 +1000
@@ -74,6 +74,7 @@
   var outputFilename = conf.outputDirectory + page + '.html';
 
   [processing.insertPageComment,
+   processing.insertSpecNameInTitle,
    processing.insertW3CStyleSheet,
    processing.insertMathJaxScript,
    processing.addBodyClass,