From 5629063b9cc80e23a725050c754bc06812333958 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 1 Nov 2012 13:32:04 +0000 Subject: [PATCH 1/2] Allow robots.txt to be custom --- src/node/hooks/express/specialpages.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index a5834492e..50d27700a 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -12,8 +12,16 @@ exports.expressCreateServer = function (hook_name, args, cb) { //serve robots.txt args.app.get('/robots.txt', function(req, res) { - var filePath = path.normalize(__dirname + "/../../../static/robots.txt"); - res.sendfile(filePath); + var filePath = path.normalize(__dirname + "/../../../static/custom/robots.txt"); + res.sendfile(filePath, function(err) + { + //there is no custom favicon, send the default robots.txt which dissallows all + if(err) + { + filePath = path.normalize(__dirname + "/../../../static/robots.txt"); + res.sendfile(filePath); + } + }); }); //serve favicon.ico From 6a027a1c2c3950c6b206ceb7c1673e73aa95cc41 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 1 Nov 2012 14:48:19 +0100 Subject: [PATCH 2/2] [docs] Document custom static files. --- doc/custom_static.md | 11 +++++++++++ doc/{all.md => index.md} | 1 + 2 files changed, 12 insertions(+) create mode 100644 doc/custom_static.md rename doc/{all.md => index.md} (76%) diff --git a/doc/custom_static.md b/doc/custom_static.md new file mode 100644 index 000000000..f646e3ba0 --- /dev/null +++ b/doc/custom_static.md @@ -0,0 +1,11 @@ +# Custom static files +Etherpad Lite allows you to include your own static files in the browser, by modifying the files in `static/custom`. + +* `index.js` Javascript that'll be run in `/` +* `index.css` Stylesheet affecting `/` +* `pad.js` Javascript that'll be run in `/p/:padid` +* `pad.css` Stylesheet affecting `/p/:padid` +* `timeslider.js` Javascript that'll be run in `/p/:padid/timeslider` +* `timeslider.css` Stylesheet affecting `/p/:padid/timeslider` +* `favicon.ico` Overrides the default favicon. +* `robots.txt` Overrides the default `robots.txt`. \ No newline at end of file diff --git a/doc/all.md b/doc/index.md similarity index 76% rename from doc/all.md rename to doc/index.md index f1e071a6d..db7cefaaa 100644 --- a/doc/all.md +++ b/doc/index.md @@ -1,4 +1,5 @@ @include documentation +@include cusotm_static @include api/api @include plugins @include database