forked from external-repos/pa11y-dashboard
Disable search engine indexing by default
This commit is contained in:
@@ -48,6 +48,9 @@ The boot configurations for pa11y-dashboard are as follows. Look at the sample J
|
|||||||
### port
|
### port
|
||||||
*(number)* The port to run the application on.
|
*(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
|
Development
|
||||||
-----------
|
-----------
|
||||||
|
12
app.js
12
app.js
@@ -11,6 +11,7 @@ module.exports = initApp;
|
|||||||
|
|
||||||
// Initialise the application
|
// Initialise the application
|
||||||
function initApp (config, callback) {
|
function initApp (config, callback) {
|
||||||
|
config = defaultConfig(config);
|
||||||
|
|
||||||
var app = new EventEmitter();
|
var app = new EventEmitter();
|
||||||
app.address = null;
|
app.address = null;
|
||||||
@@ -51,7 +52,8 @@ function initApp (config, callback) {
|
|||||||
year: (new Date()).getFullYear(),
|
year: (new Date()).getFullYear(),
|
||||||
version: pkg.version,
|
version: pkg.version,
|
||||||
repo: pkg.homepage,
|
repo: pkg.homepage,
|
||||||
bugtracker: pkg.bugs
|
bugtracker: pkg.bugs,
|
||||||
|
noindex: config.noindex
|
||||||
});
|
});
|
||||||
app.express.use(function (req, res, next) {
|
app.express.use(function (req, res, next) {
|
||||||
res.locals.isHomePage = (req.path === '/');
|
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;
|
||||||
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"webservice": "http://localhost:3000/",
|
"webservice": "http://localhost:3000/",
|
||||||
"port": 4000
|
"port": 4000,
|
||||||
|
"noindex": true
|
||||||
}
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"webservice": "http://localhost:3000/",
|
"webservice": "http://localhost:3000/",
|
||||||
"port": 4000
|
"port": 4000,
|
||||||
|
"noindex": true
|
||||||
}
|
}
|
@@ -9,6 +9,8 @@
|
|||||||
<title>{{block "title"}}</title>
|
<title>{{block "title"}}</title>
|
||||||
<meta name="description" content="{{block "description"}}"/>
|
<meta name="description" content="{{block "description"}}"/>
|
||||||
|
|
||||||
|
{{#if noindex}}<meta name="robots" content="noindex"/>{{/if}}
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="favicon.png" />
|
<link rel="icon" type="image/png" href="favicon.png" />
|
||||||
|
|
||||||
<!-- For mobile devices. -->
|
<!-- For mobile devices. -->
|
||||||
|
Reference in New Issue
Block a user