部署vuepress + github-pages

本文最后更新于:4 个月前

部署vuepress + github-pages时markdown引用本地图片以及latex问题

部署vuepress + github-pages

markdown引用本地图片以及latex问题

参考: 官方文档

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module.exports = {
title: "博客名",
description: "描述",
base: '/blog/' ,
themeConfig: {
// 你的GitHub仓库
repo: 'https://github.com/<name>/',
// 自定义仓库链接文字
repoLabel: 'My GitHub',
// 头部导航栏
nav: [
{ text: 'Home', link: '/' },
],
// 侧边导航栏
sidebar: [
['/', '首页'],
]
},
markdown: {
lineNumbers: true,
extendMarkdown: md => {
md.set({
html: true
});
// markdown编译letex公式
md.use(require('markdown-it-katex'));
// markdown禁止路径编码,解决本地图片加载问题
md.use(require("markdown-it-disable-url-encode"));
}
},
head: [
['link', {
rel: 'stylesheet',
href: 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css'
}],
['link', {
rel: "stylesheet",
href: "https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css"
}],
['link',{rel:'shortcut icon',href:'/icons/favicon.ico'}]
]
}

favicon图标引用路径

参考: 官方文档

在.vuepress/路径下手动添加public/images文件夹,在config.js中添加如下路径即可

1
2
3
4
5
6
7
head: [
['link',{
rel:'shortcut icon',
href:'/images/favicon.ico'}
]
]


部署vuepress + github-pages
http://sec-cat.github.io/2023/03/21/veupress/
作者
cat
发布于
2023年3月21日
许可协议