搞定Gridea+github+Typora+PicGo+CSDN中踩的坑
作为小白刚开始写博客,想要利用github的gitpages和图床来完成博客,中途遇见的坑记录一下各位出现类似的问题能帮到大家是最好的。
1.利用Gridea
Gridea作为一个静态博客写作客户端,操作相较于其它的方式要简单很多,而且有许多可以直接利用的博客背景,但要注意:Gridea选取的库一定不要建立在你图床选取的库下面,这样会导致你的Gridea在更新你博客对应的库文件时清除了图床中存储的数据,导致你存储在图床的图片失效
具体的建立步骤就不再赘述,可以参考博客:Github Pages+Gridea搭建个人博客
2.Github上传后的图片不显示
配置Typora和图床的具体内容可以参考博客:Markdown文档写作利器套装:Typora+PicGo+GitHub
一定注意要选择和博客不同的库作为图床!
在配置了图床后,会发现上传到图床上的图片在Typora中没有显示,显示图片加载失败。
解决方案:
打开文件 C:/Windows/System32/drivers/etc/hosts
在末尾添加:
\#GitHub Start 192.30.253.112 Build software better, together 192.30.253.119 gist.github.com 151.101.184.133 assets-cdn.github.com 151.101.184.133 raw.githubusercontent.com 151.101.184.133 gist.githubusercontent.com 151.101.184.133 cloud.githubusercontent.com 151.101.184.133 camo.githubusercontent.com 151.101.184.133 avatars0.githubusercontent.com 151.101.184.133 avatars1.githubusercontent.com 151.101.184.133 avatars2.githubusercontent.com 151.101.184.133 avatars3.githubusercontent.com 151.101.184.133 avatars4.githubusercontent.com 151.101.184.133 avatars5.githubusercontent.com 151.101.184.133 avatars6.githubusercontent.com 151.101.184.133 avatars7.githubusercontent.com 151.101.184.133 avatars8.githubusercontent.com \#GitHub End
3.Typora写好的代码上传CSDN图片不显示
系统显示外链图片转存失败,解决方案:
Typora自带的格式为:
[图片名称](https://raw.githubusercontent.com/classmate-xiaoming/img/master/img/20201210180411.png)
将其转化为html格式:
<img src="https://raw.githubusercontent.com/classmate-xiaoming/img/master/img/20201210180411.png" referrerpolicy="no-referrer" style="margin: auto;" />
转换格式后CSDN即可正确显示图片,同时这个格式也可以解决下一个问题
4.Gridea预览正常的博客在网页上图片无法显示
在Gridea上预览没有问题,但同步后在网页上出现问题,图片无法显示,解决方案:
图片部分选择html格式的markdown,并且加入 referrerpolicy=“no-referrer”:
<img src="" referrerpolicy="no-referrer" style="margin: auto;" />
再同步后在博客上便可以正常显示。