Favicon updated to use 4 different sizes
-Instead of using a single file for the favicon, there are now 4 size options for a more modern favicon experience as inspired by this article: https://www.emergeinteractive.com/insights/detail/The-Essentials-of-FavIcons/ -Old default favicon file has been replaced with 4 different sized pngs -Not all sizes need to be set. If any of the new settings are left blank or the filename does not exist, that favicon size will be skipped
This commit is contained in:
@@ -49,7 +49,24 @@ if (settings.webserver.cors.enabled == true) {
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'pug');
|
||||
|
||||
app.use(favicon(path.join(__dirname, settings.shared_pages.favicon)));
|
||||
var default_favicon = '';
|
||||
|
||||
// loop through the favicons
|
||||
Object.keys(settings.shared_pages.favicons).forEach(function(key, index, map) {
|
||||
// remove the public directory from the path if exists
|
||||
if (settings.shared_pages.favicons[key] != null && settings.shared_pages.favicons[key].indexOf('public/') > -1)
|
||||
settings.shared_pages.favicons[key] = settings.shared_pages.favicons[key].replace(/public\//g, '');
|
||||
|
||||
// check if the favicon file exists
|
||||
if (!db.fs.existsSync(path.join('./public', settings.shared_pages.favicons[key])))
|
||||
settings.shared_pages.favicons[key] = '';
|
||||
else if (default_favicon == '')
|
||||
default_favicon = settings.shared_pages.favicons[key];
|
||||
});
|
||||
|
||||
if (default_favicon != '')
|
||||
app.use(favicon(path.join('./public', default_favicon)));
|
||||
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
Reference in New Issue
Block a user