Disable search engine indexing by default

This commit is contained in:
Rowan Manning
2013-11-15 15:58:49 +00:00
parent 85b70c5679
commit 55d44685e9
5 changed files with 20 additions and 3 deletions

View File

@@ -48,6 +48,9 @@ The boot configurations for pa11y-dashboard are as follows. Look at the sample J
### port
*(number)* The port to run the application on.
### noindex
*(boolean)* If set to `true` (default), the dashboard will not be indexed by search engines. Set to `false` to allow indexing.
Development
-----------

12
app.js
View File

@@ -11,6 +11,7 @@ module.exports = initApp;
// Initialise the application
function initApp (config, callback) {
config = defaultConfig(config);
var app = new EventEmitter();
app.address = null;
@@ -51,7 +52,8 @@ function initApp (config, callback) {
year: (new Date()).getFullYear(),
version: pkg.version,
repo: pkg.homepage,
bugtracker: pkg.bugs
bugtracker: pkg.bugs,
noindex: config.noindex
});
app.express.use(function (req, res, next) {
res.locals.isHomePage = (req.path === '/');
@@ -93,3 +95,11 @@ function initApp (config, callback) {
});
}
// Get default configurations
function defaultConfig (config) {
if (typeof config.noindex !== 'boolean') {
config.noindex = true;
}
return config;
}

View File

@@ -1,4 +1,5 @@
{
"webservice": "http://localhost:3000/",
"port": 4000
"port": 4000,
"noindex": true
}

View File

@@ -1,4 +1,5 @@
{
"webservice": "http://localhost:3000/",
"port": 4000
"port": 4000,
"noindex": true
}

View File

@@ -9,6 +9,8 @@
<title>{{block "title"}}</title>
<meta name="description" content="{{block "description"}}"/>
{{#if noindex}}<meta name="robots" content="noindex"/>{{/if}}
<link rel="icon" type="image/png" href="favicon.png" />
<!-- For mobile devices. -->