Fix preconnect config for venders with custom cdn (#506)

Co-authored-by: Ljcbaby <46277145+ljcbaby@users.noreply.github.com>
This commit is contained in:
Dylan Zhang 2022-04-29 13:43:46 +08:00 committed by GitHub
parent 0dacb430b7
commit 46f6efce94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 || '').hostname,
local : 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 || '').hostname
custom : parse(custom_cdn_url || '').protocol + '//' + parse(custom_cdn_url || '').hostname
};
const h = enable ? host || 'https://fonts.googleapis.com' : '';
const i = links[internal];