mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 22:31:15 +00:00
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
|
||||
*(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
12
app.js
@@ -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;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"webservice": "http://localhost:3000/",
|
||||
"port": 4000
|
||||
"port": 4000,
|
||||
"noindex": true
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"webservice": "http://localhost:3000/",
|
||||
"port": 4000
|
||||
"port": 4000,
|
||||
"noindex": true
|
||||
}
|
@@ -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. -->
|
||||
|
Reference in New Issue
Block a user