reuixiy / hugo-theme-meme

😝 You can’t spell awesome without MemE!
https://io-oi.me/hugo-theme-meme
MIT License
1.01k stars 279 forks source link

不能正常加载glyph-correction系列字体 #287

Closed jianse closed 3 years ago

jianse commented 3 years ago

问题描述

当把config.toml中的baseURL设置为非根目录时(例如http://example.com/blog)不能够正常加载glyph-correction系列字体

示例

克隆这个仓科 https://github.com/jianse/meme_bug_showcase 然后

hugo server

访问本地服务器查看开发者工具

reuixiy commented 3 years ago

因为 glyph-correction 的路径是绝对路径:

https://github.com/reuixiy/hugo-theme-meme/blob/ff744203ea3287b3e317bb0b439ee8bb529aa038/assets/scss/base/_glyph-correction.scss#L4-L7

可以定制成相对路径试试,https://github.com/reuixiy/io-oi.me/blob/master/assets/scss/base/_glyph-correction.scss

jianse commented 3 years ago

这个问题是跟配置文件中的baseURL相关的,可以这样修改主题 https://github.com/jianse/hugo-theme-meme/blob/master/assets/scss/base/_glyph-correction.scss 可以免去用户覆盖该文件

reuixiy commented 3 years ago

还有一种 case 是 defaultContentLanguageInSubdirtrue

https://github.com/reuixiy/hugo-theme-meme/blob/ff744203ea3287b3e317bb0b439ee8bb529aa038/config-examples/en/config.toml#L19

这时候,比如默认的语言为 zh,Hugo 会将根路径 / 变成 /zh/,不知道你的这段修改能不能 cover 这种 case

方便帮忙测试一下吗?如果成功,也许你可以提一个 PR,我们可以将之合并进来