更换字体「霞鹜文楷」

「霞鹜文楷」

看到别人博客换了字体,超级好看,我也要😊!!

项目地址:https://github.com/lxgw/LxgwWenKai

「霞鹜文楷」是一款开源中文字体,基于 FONTWORKS 出品字体 Klee One 衍生。

这是使用的是墨语提供的教程,在配置的过程中我遇到了一些问题,感谢博主的热心解答🎉

我的博客是部署在GitHub上,由于博客的主题文件是使用hugo-theme-stack仓库作为博客的子模块,

根据主题stack的document说明:

If you installed the theme through Git / Git submodule, you can modify the theme file directly and see the changes in your local site.

However, you can not commit and push the changes directly since you don’t have the permission to push to the theme repository.

You need to fork the theme repository and push your changes to your forked repository (change submodule’s repository url). Then, you can commit those changes to your site repository.

如果你通过 Git/Git 子模块安装了主题,可以直接修改主题文件,在本地站点中查看更改。

但是,您无法直接提交和推送更改,因为您没有推送到主题存储库的权限。

您需要fork主题存储库并将更改推送到分支存储库(更改子模块的存储库 URL)。然后,您可以将这些更改提交到站点存储库。

因为这个原因,按照博主文章提供的方法修改部署后没有效果image-20230722000207898

可以直接复制下面的代码

1
2
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-lite-webfont@1.1.0/style.css');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/cascadia-code@4.2.1/index.min.css');

1
2
3
4
5
:root {
    --zh-font-family: 'LXGW WenKai Lite';
    --base-font-family: var(--zh-font-family), sans-serif;
    --code-font-family: 'Cascadia Code', var(--zh-font-family), monospace;
}

解决方法是修改博客根目录下相同路径文件

比如我的博客主题文件目录为MyBlog\themes\hugo-theme-stack,现在修改文件的路径为MyBlog\assets\scss

修改后部署发布即可。

效果展示

image-20230722001413058

Licensed under CC BY-NC-SA 4.0
Built with Hugo with 主题 StackJimmy 设计