安知鱼主题替换Friend-Circle-Lite:轻量友链朋友圈

AI-摘要
NaoKuo GPT
AI初始化中...
介绍自己 🙈
生成本文简介 👋
推荐相关文章 📖
前往主页 🏠
前往爱发电购买
参考文章
爬取服务部署
- 添加对应npm包
1
2npm i yamljs --save
npm i fs --save 在博客根目录添加文件
link.js
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
31const YML = require('yamljs')
const fs = require('fs')
const blacklist = ["友站链接1", "友站链接2", "友站链接3"]; // 由于某种原因,不想订阅的列表
// const blacklist = ["https://www.naokuo.top", "https://hexo.io/zh-cn", "https://docs.anheyu.com"]; // 由于某种原因,不想订阅的列表
let friends = [],
data_f = YML.parse(fs.readFileSync('source/_data/link.yml').toString().replace(/(?<=rss:)\s*\n/g, ' ""\n'));
data_f.forEach((entry, index) => {
let lastIndex = 3;
if (index < lastIndex) {
const filteredLinkList = entry.link_list.filter(linkItem => !blacklist.includes(linkItem.link));
friends = friends.concat(filteredLinkList);
}
});
// 根据规定的格式构建 JSON 数据
const friendData = {
friends: friends.map(item => {
return [item.name, item.link, item.avatar];
})
};
// 将 JSON 对象转换为字符串
const friendJSON = JSON.stringify(friendData, null, 2);
// 写入 friend.json 文件
fs.writeFileSync('./source/friend.json', friendJSON);
console.log('friend.json 文件已生成。');然后再在根目录执行:
1
node link.js
Fork
Friend-Circle-Lite
仓库到你自己的GitHub
账号下修改
Friend-Circle-Lite/conf.yaml
下的参数我只修改了以下参数,其他都没有启用
1
2
3
4
5
6
7
8
9
10
11
12
13
14# 解释:使用request实现友链文章爬取,并放置到根目录的all.json下
# enable: 是否启用爬虫
# json_url: 请填写对应格式json的地址,仅支持网络地址
# article_count: 请填写每个博客需要获取的最大文章数量
# marge_result: 是否合并多个json文件,若为true则会合并指定网络地址和本地地址的json文件
# enable: 是否启用合并功能,该功能提供与自部署的友链合并功能,可以解决服务器部分国外网站无法访问的问题
# marge_json_path: 请填写网络地址的json文件,用于合并,不带空格!!!
spider_settings:
enable: true
json_url: "https://blog.naokuo.top/friend.json"
article_count: 5
merge_result:
enable: true
merge_json_url: "https://blog.naokuo.top"然后在
Action
中运行Friend Circle Lite
脚本
前端部署
修改
_config.anzhiyu.yml
配置文件1
2
3
4
5
6
7
8# 朋友圈配置
friends_vue:
enable: true
vue_js: https://blog.naokuo.top/js/naokuo/friends_vue/fclite.js
vue_css: https://blog.naokuo.top/js/naokuo/friends_vue/fclite.css
apiurl: https://fastly.jsdelivr.net/gh/YL2209/Friend-Circle-Lite@page/all.json # 朋友圈数据地址
top_tips: 使用 友链朋友圈 订阅友链最新文章
top_background: 'https://cdn.cbd.int/naokuo-blog@1.2.12/img/posts/posts5.webp'修改随机朋友圈文章
themes/anzhiyu/source/js/anzhiyu/random_friends_post.js
1
2# 下载
https://blog.naokuo.top/js/anzhiyu/random_friends_post.js修改
themes/anzhiyu/layout/includes/page/fcircle.pug
文件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
40if theme.friends_vue.enable
.fcircle_page
.author-content.author-content-item.fcirclePage.single(style = `background: url(${theme.friends_vue.top_background}) left 28% / cover no-repeat !important;`)
.card-content
.author-content-item-tips 友链
span.author-content-item-title 最新文章订阅
.content-bottom
.tips=theme.friends_vue.top_tips
.banner-button-group
a.banner-button(onclick=`pjax.loadUrl('/about')`)
i.naokuofont.naokuo-icon-circle-arrow-up-right-1(style='font-size: 22px; margin-right: 0.25rem')
span.banner-button-text 关于本人
.title-h2-a
.title-h2-a-left
h2(style='padding-top:0;margin:.6rem 0 .6rem') 🎣 钓鱼
a.random-post-start(href='javascript:fetchRandomPost();')
i.naokuofont.naokuo-icon-arrow-rotate-right
.title-h2-a-right
a.random-post-all(href='/flink/') 全部友链
#random-post
.title-h2-a
.title-h2-a-left
h2(style='padding-top:0;margin:.6rem 0 .6rem') 🐟 鱼塘
#friend-circle-lite-root
if (theme.friends_vue.apiurl)
script.
if (typeof UserConfig === 'undefined') {
var UserConfig = {
// 填写你的fc Lite地址
private_api_url: '!{theme.friends_vue.apiurl}',
// 点击加载更多时,一次最多加载几篇文章,默认20
//- page_turning_number: 20,
// 头像加载失败时,默认头像地址
error_img: '!{theme.error_img.flink}',
}
}
link(rel="stylesheet" href=url_for(theme.friends_vue.vue_css))
script(defer data-pjax src=url_for(theme.friends_vue.vue_js))
script(defer data-pjax src=url_for(theme.asset.random_friends_post_js))不出意外的话应该可以使用了
评论
匿名评论隐私政策
✅ 你无需删除空行,直接评论以获取最佳展示效果