Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ favicon:
safari_pinned_tab: /images/logo.svg
#android_manifest: /manifest.json

# Generate webmanifest file for PWA. Path can be customized in `favicon.android_manifest`.
webmanifest:
enable: false

# Custom Logo (Warning: Do not support scheme Mist)
custom_logo: #/uploads/custom-logo.png

Expand Down
5 changes: 5 additions & 0 deletions scripts/generators/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* global hexo */

'use strict';

hexo.extend.generator.register('webmanifest_generator', () => require('./lib/webmanifest')(hexo));
12 changes: 12 additions & 0 deletions scripts/generators/lib/webmanifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

module.exports = hexo => {
const theme = hexo.theme.config;
const { enable, ...webmanifest } = theme.webmanifest;
if (enable) {
return {
path: theme.favicon.android_manifest || 'manifest.json',
data: JSON.stringify(webmanifest)
};
}
};