魔改主题兼容轻量友链朋友圈

魔改主题兼容轻量友链朋友圈

提醒

2024-11-01:新发现问题,已修复为最新点击查看

警告

2024-10-09:发现一个新问题友链钓鱼没有完美适配点击查看

轻量朋友圈

开始操作前,你需要部署好轻量朋友圈

Friend-Circle-Lite

效果

跟原版没什么区别,可以前往我的朋友圈页面查看

朋友圈

正文

警告

修改前须知,改完后原版的朋友圈配置将无效,本次共修改两个文件添加一个配置项

创建页面

在 Hexo 博客根目录 [blog]下打开终端,输入

bash
hexo new page fcircle

打开[blog]\source\fcircle\index.md,添加一行type: 'fcircle'

yaml
---
title: 朋友圈
comments: false
aside: false
top_img: false
type: "fcircle"
---

主题配置文件中开启menu中友链,导航栏朋友圈,注意缩进!!!

替换fcircle.pug

文件目录themes\anzhiyu\layout\includes\page\fcircle.pug

替换random_friends_post.js

文件目录themes\anzhiyu\source\js\anzhiyu\random_friends_post.js

适配友链钓鱼

提醒

2024-11-01 已更新修复问题

文件目录themes\anzhiyu\layout\includes\page\flink.pug

搜索 #random-post修改为下面所示:

pug
#random-post
script(defer data-pjax src=url_for(theme.asset.random_friends_post_js))
script.
  if (typeof UserConfig === 'undefined') {
    var UserConfig = {
      private_api_url: '#{theme.friends_lite.private_api_url}',
      page_turning_number: #{theme.friends_lite.page_turning_number},
      error_img: '#{theme.friends_lite.error_img}'
    }
  }

搜索 .banner-button-group 修改为以下内容

pug
.banner-button-group
  if (theme.friends_lite.private_api_url)

添加配置项

主题配置文件中添加一段

yaml
# Lite朋友圈配置
friends_lite:
  enable: true
  fclite_css_url: https://fc.ruom.top/main/fclite.css  # 轻量朋友圈的CSS
  fclite_js_url: https://fc.ruom.top/main/fclite.js    # 轻量朋友圈的js
  private_api_url: https://fc.ruom.top/                # 获取json的API URL
  page_turning_number: 20                              # 每页显示的文章数量
  error_img: https://cdn.bsgun.cn/Hexo-static/img/error-404.avif  # 404图片 URL
  top_background: https://cdn.bsgun.cn/Hexo-static/img/essay-bg.avif  # 顶部背景图片 URL
  top_tips: 使用 轻量友链朋友圈 订阅友链最新文章        # 顶部提示文本
警告

请自行替换配置中内容,最后hexo三连,刷新查看效果

不修改主题pug方案

如果你不想修改主题文件,可以无视替换fcircle.pug,直接在\source\fcircle\index.md中添加如下内容

当然random_friends_post.js还是需要替换的,具体内容按照你的配置修改即可

出现的问题

我后期发现的一些问题归档在这里

随机访问点击无效

搜索配置项randomFriends查看enable是否为truerandomFriends是否配置数量

yaml
  list:
    enable: true
    randomFriends: 3

结束

如果文章内容有错误地方,欢迎下方评论

Twikoo邮件通知模板分享
关于主题的一些魔改

评论区

评论加载中...