ppoffice / hexo-theme-icarus

A simple, delicate, and modern theme for the static site generator Hexo.
https://ppoffice.github.io/hexo-theme-icarus/
MIT License
6.28k stars 1.53k forks source link

无法添加Cdnjs类CDN模板 #1012

Closed Lemonawa closed 2 years ago

Lemonawa commented 2 years ago

确保你在提交Bug反馈之前仔细阅读了Hexo文档Icarus用户指南,和GitHub issues来了解你的问题是否已经被他人提出过。

Bug描述 无法添加Cdnjs类CDN模板

系统与环境 Hexo环境:

hexo: 6.0.0
hexo-cli: 4.3.0
os: win32 10.0.22526
node: 16.9.1
v8: 9.3.345.16-node.12
uv: 1.42.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.17.2
modules: 93
nghttp2: 1.42.0
napi: 8
llhttp: 6.0.2
openssl: 1.1.1l+quic
cldr: 39.0
icu: 69.1
tz: 2021a
unicode: 13.0
ngtcp2: 0.1.0-DEV
nghttp3: 0.1.0-DEV

复现方式 按照

https://ppoffice.github.io/hexo-theme-icarus/Configuration/icarus%E7%94%A8%E6%88%B7%E6%8C%87%E5%8D%97-cdn%E6%8F%90%E4%BE%9B%E5%95%86/

中对于添加Cdnjs类CDN模板的描述,在_config.icarus.yml中更改如下:

# CDN provider settings
# https://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/
providers:
    # Name or URL template of the JavaScript and/or stylesheet CDN provider
    cdn: [cdnjs]https://cdn.staticfile.org/${package}/${version}/${filename}
    # Name or URL template of the webfont CDN provider
    fontcdn: google
    # Name or URL of the fontawesome icon font CDN provider
    iconcdn: fontawesome

随后运行

hexo clean

出现报错:

    position: 14530,
    line: 405,
    column: 16,
    snippet: ' 403 | # https://ppoffice.github.io/hexo-theme-icarus/ ...\n' +
      ' 404 | providers:\n' +
      ' 405 |     # Name or URL template of the JavaScript an ...\n' +
      ' 406 |     cdn: [cdnjs]https://cdn.staticfile.org/${pa ...\n' +
      '-----------------------^\n' +
      ' 407 |     # Name or URL template of the webfont CDN p ...\n' +
      ' 408 |     fontcdn: google'
  }
}

期望行为 运行成功,CDN成功被替换

截图 如果可以的话,请附上几张截图来帮助说明你遇到的问题。

额外上下文 附上与问题有关的其他上下文信息。

ppoffice commented 2 years ago

URL用单引号围起来试试

Lemonawa commented 2 years ago

URL用单引号围起来试试

不行

    position: 14530,
    line: 405,
    column: 16,
    snippet: ' 403 | # https://ppoffice.github.io/hexo-theme-icarus/ ...\n' +
      ' 404 | providers:\n' +
      ' 405 |     # Name or URL template of the JavaScript an ...\n' +
      " 406 |     cdn: [cdnjs]'https://cdn.staticfile.org/${p ...\n" +
      '-----------------------^\n' +
      ' 407 |     # Name or URL template of the webfont CDN p ...\n' +
      ' 408 |     fontcdn: google'
  }
}
ppoffice commented 2 years ago

[cdnjs]是在括号里面的

Lemonawa commented 2 years ago

[cdnjs]是在括号里面的

感谢,完美解决