Fix null custom_cdn_url

This commit is contained in:
Mimi 2022-05-11 16:13:40 +08:00
parent d367d0c244
commit 431540f4a0

View File

@ -58,11 +58,11 @@ hexo.extend.helper.register('next_pre', function() {
const { enable, host } = this.theme.font;
const { internal, plugins, custom_cdn_url } = this.theme.vendors;
const links = {
local : parse(this.theme.js || '').protocol + '//' + parse(this.theme.js || '').hostname,
local : this.theme.js && parse(this.theme.js).hostname ? parse(this.theme.js).protocol + '//' + parse(this.theme.js).hostname : '',
jsdelivr: 'https://cdn.jsdelivr.net',
unpkg : 'https://unpkg.com',
cdnjs : 'https://cdnjs.cloudflare.com',
custom : parse(custom_cdn_url || '').protocol + '//' + parse(custom_cdn_url || '').hostname
custom : custom_cdn_url && parse(custom_cdn_url).hostname ? parse(custom_cdn_url).protocol + '//' + parse(custom_cdn_url).hostname : ''
};
const h = enable ? host || 'https://fonts.googleapis.com' : '';
const i = links[internal];