h
helloworld581
V1
2023/04/27阅读:14主题:默认主题
为Hexo博客next主题添加友链
为Hexo博客next主题添加友链

🌈Description: 本文将介绍如何为Hexo博客next主题添加友链,方便你与其他博主进行联系,同时可以引流。
效果展示
先看实际效果,如果感觉ok,就可以继续往下看,否则请节省时间逛逛别的文章: 链接在这里
添加友链的方法
修改hexo的next主题配置文件_config.next.yml
我的_config.next.yml是在根目录下,打开后,在menu节点下,添加这一行: link: /links/ || fa fa-link
将配置文件中的link备注中文名称
打开目录Hexo_Blog\node_modules\hexo-theme-next\languages
,打开文件zh-CN.yml
,在menu节点下添加这一行: link: 友链
添加友链页面
打开目录Hexo_Blog\source
新建文件夹links
,在Hexo_Blog\source\links
下新建文件index.md
,添加如下内容:
---
title: 友情链接
date: 2023-04-26 00:34:27
---
<div class="post-body">
<div id="links">
<style>
.links-content{
margin-top:1rem;
}
.link-navigation::after {
content: " ";
display: block;
clear: both;
}
.card {
width: 45%;
font-size: 1rem;
padding: 10px 20px;
border-radius: 4px;
transition-duration: 0.15s;
margin-bottom: 1rem;
display:flex;
}
.card:nth-child(odd) {
float: left;
}
.card:nth-child(even) {
float: right;
}
.card:hover {
transform: scale(1.1);
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
}
.card a {
border:none;
}
.card .ava {
width: 3rem!important;
height: 3rem!important;
margin:0!important;
margin-right: 1em!important;
border-radius:4px;
}
.card .card-header {
font-style: italic;
overflow: hidden;
width: 100%;
}
.card .card-header a {
font-style: normal;
color: #2bbc8a;
font-weight: bold;
text-decoration: none;
}
.card .card-header a:hover {
color: #d480aa;
text-decoration: none;
}
.card .card-header .info {
font-style:normal;
color:#a3a3a3;
font-size:14px;
min-width: 0;
overflow: hidden;
white-space: nowrap;
}
</style>
<div class="links-content">
<div class="link-navigation">
<div class="card">
<img class="ava" src="https://laosu.ml/images/laosu_wx.jpg" />
<div class="card-header">
<div>
<a href="https://laosu.ml/">杨浦老苏</a>
</div>
<div class="info">聚沙成塔,集腋成裘 </div>
</div>
</div>
<div class="card">
<img class="ava" src="https://weicun.gitee.io/images/logo.png" />
<div class="card-header">
<div>
<a href="https://weicun.gitee.io/">蓝色单车</a>
</div>
<div class="info">软件评测、AI、感悟,分享好玩的东东</div>
</div>
</div>
</div>
</div>
</div>
</div>
如果你想单车一样用obsidian编辑器对html编辑不友好,建议在VS code或者sublime text里面编辑好在粘贴过来。 如果有小伙伴请求添加友链,你只需要在上述代码的技术上添加如下代码块即可:
<div class="card">
<img class="ava" src="https://laosu.ml/images/laosu_wx.jpg" />
<div class="card-header">
<div>
<a href="https://laosu.ml/">杨浦老苏</a>
</div>
<div class="info">聚沙成塔,集腋成裘 </div>
</div>
</div>
这里添加了我最喜欢的一个博主:老苏的博客,虽然没有经过他的允许,但是我还是很想把他分享给大家,因为他的文章的确是纯纯的干货文章。
总结
好了,至此我们已经完成了全部工作,回顾下其实就三个步骤:
-
修改hexo的next主题配置文件_config.next.yml -
将配置文件中的link备注中文名称 -
添加友链页面 现在你可以部署你的hexo博客看效果了( hexo clean、hexo g、hexo s、hexo d
),希望能看到你满意的效果。 有什么问题欢迎留言。
对了,如果大家喜欢可以关注我的博客和微信公众号,平时会经常分享一下软件、AI、感悟、好玩的东东。谢谢啦。或者个人博客:https://weicun.gitee.io/ 蓝色单车
作者介绍
h
helloworld581
V1