logo 范 · 拾光录
网址收集 关于作者 Github Gitee
杂文随笔5
Hexo博客:基础使用Hexo博客:Next主题Hexo博客:Next进阶使用Hexo博客:Next高级配置基于Node的WIKI管理
前端知识16
HTML常用知识CSS常用知识CSS美化checkbox复选框JavaScript常用知识JavaScript格式化时间戳JavaScript窗口宽高处理JavaScript黑夜主题切换实现方案JavaScript数字转大写简易图片查看器TypeScript基础知识Threejs基础三要素Threejs网格辅助和轨道控制器Threejs物体绘制Electron基础使用Nodejs基础知识animate.css页面动画
Vue框架19
Vite的使用及扩展Vue3父子组件Vue3使用Marked解析MarkdownMermaid图表生成库初始化页面加载动画Axios表单提交二维码解决方案NProgress加载进度条Vue3动态菜单实现Vue3使用ECharts图表Vue3处理Excel导入导出keep-alive页面缓存及setup问题Element:文件上传Element:结合Pinia实现动态菜单Element:图片上传组件Element:自定义统一弹窗组件Element:表格自定义指令控制按钮显示(鉴权)可视化大屏使用缩放适配分辨率
UniApp15
UniApp的基础使用封装网络请求工具及文件上传uni-app的开发记录微信小程序分享原生文件上传Pinia取消滚动条(兼容小程序)tabbar消息数量显示scroll-view上滑到底部加载数据状态栏高度动态设配数据共享与传递uview-plus导航栏实现背景融合Wot UIWot UI实现顶部背景图融合uni-app x
Java基础知识10
基础知识面向对象Lambda表达式常用API常用知识积累try-with-resource注解反射多线程经纬度距离计算
SpringBoot31
application配置Maven创建聚合项目全局异常处理锁机制项目启动初始化数据方式邮件功能集成原生定时任务异步集成阿里云OSS阿里OSS预签名上传基于hutool读excelJSR303WebSocketWebSocket版AI接口流式调用Smart-Doc接口文档生成器application配置信息加密雪花算法工具AOP实现请求参数脱敏思路JWT生成Token及工具类SpringBoot默认JSON与对象转换若依框架:安装使用若依框架:优化和调整文件上传若依框架:管理后台页面优化若依框架:后端接口代码优化SpringAISpringBoot实现AI接口流式调用服务启动时创建MySQL连接自建项目工程树形结构处理工具微信支付代码微信手机号登录
SpringMVC14
跨域处理拦截器RESTful风格伪前后端分离Jackson转换器调整Thymeleaf基于拦截器做权限校验AOP打印接口请求响应日志AOP打印接口请求响应耗时文件上传和回显POST请求加解密实现(AES)POST请求加解密实现(RSA+AES)参数动态校验实现方案真实IP和归属地
MyBatis8
MyBatis基本使用与配置Mapper使用相关MaBatis多数据源配置MyBatisPlus数据统计类处理方案MyBatisPlus条件查询正向工程的实现(H2)mybatis-plus-join
SpringCloud15
Netflix:微服务与搭建Netflix:服务的消费与提供Netflix:EurekaNetflix:ActuatorNetflix:RibbonNetflix:FeignNetflix:HystrixNetflix:ZuulAlibaba:简介与搭建Alibaba:Nacos注册中心Alibaba:RibbonAlibaba:OpenFeignAlibaba:Nacos配置中心Alibaba:GetewayAlibaba:Sentinel
MySQL6
MySQL基础知识MySQL多表查询与事务MySQL常用函数及解决方案MySQL视图MySQL索引安装MySQL
Redis7
Redis介绍和安装Redis配置文件Redis持久化Redis集群Redis语法基础Redis相关问题及解决方案SpringBoot集成Redis使用记录
MongoDB10
Linux安装MongoDBMongoDB基础语法MongoTemplate及SpringBoot配置MongoTemplate中Update操作MongoTemplate中聚合查询MongoTemplate日期归档示例项目使用相关知识归纳地理位置存储与距离查询MongoDB副本集与事务获取类名和属性名工具类
其他数据库1
H2数据库
Python编程6
Python基础知识Python语法yolo目标检测OpenCV的使用及树莓派平台condauv
工具集合13
IDEAMavenGradleGitNginx安装Nginx配置VSCodeJMeter压测DockerOllamaRustFSPicGoObs录制
Linux知识11
Linux常用命令Jar启动脚本VirtualBox安装CentOSVirtualBox安装Ubuntu树莓派安装及使用frp内网穿透ArchLinux:基础系统安装ArchLInux:图形化界面安装ArchLinux:常用软件ArchLinux:深度优化ArchLinux:Niri
创意设计2
Blender:入门知识UI设计基础知识
AI相关9
Claude CodeHermes AgentOpenAI基本使用OpenAI工具调用OpenAI记忆管理OpenAI推理执行OpenAI开发框架Langchainllama.cpp

CSS样式调整

在文件source/css/main.styl中的末尾增加自己喜欢的样式,如:

body {
  // 字体调整
  font-family: Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
  // 防止页面因没有滚动条导致的右移现象
  min-height: 100.1vh;
}

之后的样式都写在这里,能覆盖默认样式

网站名导航背景

// 侧边网站名背景
.site-brand-container {
  background-image: url(/images/side_bg.png);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

固定页面宽度

注意:测试主题为Pisces,使用过5.x版本的Next就会发现,那时的页面宽度是固定的,并且比较窄,而升级到8.x后,发现页面宽度较宽,而且屏幕越大越宽,解决办法:编辑source/css/_variables/Pisces.styl

$content-desktop-large        = 1400px;
$content-desktop-largest      = 1400px;

关闭代码行数

// 调整内距
figure.highlight .table-container {
    padding: 0 4px;
}
// 关闭代码行数
figure.highlight .table-container .gutter{
  display: none;
}

美化滚动条

/* 定义滚动条 */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
    border-radius: 10px;
}
/* 定义滚动条滑块 */
::-webkit-scrollbar-thumb {
    background-color: #0003;
    border-radius: 10px;
}
/* 滑块hover效果 */
::-webkit-scrollbar-thumb:hover {
    background: #B2B2B2;
}

字体大小调整

// 文章整体字体大小
.post-body {
  font-size: 16px;
}
// 文章目录文字大小
.sidebar-panel-container{
  font-size: 15px;
}

取消顶部横条

// 取消顶部横条
.headband {
  display: none;  
}

图片增加边框

// 图片增加边框
.post-body img {
  border: 1px solid rgba(0,0,0,0.1);
}

隐藏侧边作者名字

// 隐藏侧边作者名字
.site-author-name {
  display: none;
}

作者描述样式调整

字数少不建议

// 作者描述样式调整
.site-description {
  text-align: left;
  text-indent: 2em;
  margin: 12px 0;
  font-size: 0.85em;
  padding: 0 28px;
}

文字选中颜色

// 文字选中颜色
::-moz-selection {
  // firefox
  background: #3367d1;
  color: #ffffff;    
}
::selection {
  // 其他浏览器
  background: #3367d1;
  color: #ffffff; 
}

取消代码块部分加粗

// 取消代码块部分加粗
.hljs-attribute, .hljs-doctag, .hljs-keyword, .hljs-meta .hljs-keyword, .hljs-name, .hljs-selector-tag, .hljs-section, .hljs-title {
  font-weight: 500;
}

文章大纲美化

// 文章大纲美化(取消数字后)
.post-toc ol {
  padding: 0 12px;
}
.nav-item a {
  border-bottom: 1px solid #fff;
  transition: all .2s;
}
.nav-item a:hover {
  border-bottom: 1px solid #999;
}

分类中多余图片

分类的作用本就是快速查找到文章,结果发现文章中photo的图片出现在了分类中,实属占地😂,去除方法,打开layout/_macro/post-collapse.njk,注释或删除以下代码:

{{ post_gallery(post.photos) }}

分类中月份处理

调整分类中的时间显示格式,在layout/_macro/post-collapse.njk将格式化更改为YYYY-MM-DD

<div class="post-meta-container">
  <time itemprop="dateCreated"
        datetime="{{ moment(post.date).format() }}"
        content="{{ date(post.date, config.date_format) }}">
    {{ date(post.date, 'YYYY-MM-DD') }}
  </time>
</div>

当文章的年份不一样时,会出现以下情况,不是很美观,所以建议将年取消,在layout/_macro/post-collapse.njk将以下代码删除

{%- if year !== current_year %}
  {%- set current_year = year %}
  <div class="collection-year">
    <span class="collection-header">{{ current_year }}</span>
  </div>
{%- endif %}

同时对样式进行调整:

// 调整分类中文章间隔
.posts-collapse .post-content .post-header {
  margin: 15px 0px;
}

// 修复分类中文章做出小点位置
.posts-collapse .post-content .post-header::before {
  left: -4px;
}

同时也可以在网站配置文件中对分类下文章分页数量进行设置

# Pagination
## Set per_page to 0 to disable pagination
per_page: 100
pagination_dir: page

其他样式相关调整

// 分页样式
.pagination .page-number.current {
  background: #222222;
  border-color: #222222;
  color: #fff;  
}
// 减少文章与顶部的距离(首页和文章页)
.post-block:first-of-type {
  padding-top: 0;
}
// 调整文章标题上下的间距
.posts-expand .post-title {
  margin: 20px 0 15px 0;
}
// 文章标题与图片距离
.posts-expand .post-gallery {
  margin-bottom: 10px;
}
// 首页文章标题与简介距离
.posts-expand .post-header {
  margin-bottom: 10px;
}
// 首页文章简介与阅读更多按钮距离
.post-button {
  margin-top: 20px;  
}
// 文章信息与文章内容的间距
.post-meta {
  margin-bottom: 20px;
}
// 文章段落间距调整
.post-block p {
  margin-bottom: 15px;
  line-height: 1.7;
}
// 调整表格
th, td {
  border-bottom: none;
}
// 引用样式
blockquote {
  border: 1px solid rgb(165, 194, 255) !important;
  background: linear-gradient(137deg, #f5eeff, #e6f4ff 52%, #ecf0ff 97%) !important;
  padding: 15px !important;
  margin: 0 !important;
}
// 引用距离调整
blockquote p {
  margin: 0 !important;
  padding: 10px 0;
  color: #615ced !important;
  font-size: 15px !important;
}
// 行内代码块
code {
  background-color: #e2e3ff;
  color: #7459ee;
  margin: 0 3px;
  display: inline-block;
  padding: 0 5px;
  font-size: 14px !important;
}
// 超链接样式
.post-body p a {
  color: #65a1d6;
  transition: all .1s;
  display: inline-block;
  margin: 0 2px;
}
.post-body p a:hover {
  color: #ff7600;
}

自定义分类到侧边

如果习惯使用一级分类,在使用时会发现点击分类会多点击一次,其实可以将分类放到侧边更加便捷,编辑layout/_layout.njk,在<header>中加入以下代码:

<header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="header-inner">
    {%- include '_partials/header/index.njk' -%}
  </div>

  {# 自定义分类 #}
  <div class="header-inner myCate sidebar animated fadeInUp">{% include '_partials/page/categoriesCustom.njk' %}</div>
  
  {%- if theme.sidebar.display !== 'remove' %}
    {% block sidebar %}{% endblock %}
  {%- endif %}
</header>

然后创建layout/_partials/page/categoriesCustom.njk文件,内容为:

<div class="category-all-page">
  <div class="category-all">
    {{ list_categories() }}
  </div>
</div>

然后就可以把导航中的分类隐藏了,并对样式做相应的调整:

// 自定义分类样式调整
.myCate {
  margin-top: 12px;
  box-sizing: border-box;  
  padding: 1em 0;
  border-radius: 1px;
  background-color: #fff;
}
.cate-title {
  height: 20px;
  width: 100%;
  font-size: 0.8125em;
  padding: 0 20px 10px 20px;
  font-weight: bold;
}
.myCate li {
  padding: 0 10px;
  line-height: 32px;
  border-radius: 3px;
}
.category-all-page .category-list {
  padding: 0 10px !important;
}
.myCate .category-list-item {
  margin: 0;
  transition: all .2s;
  display: flex;
}
.myCate .category-list-item:hover {
  background-color: #F5F5F5;  
}
.myCate .category-all {
  margin-top: 0;  
}
// 自定义分类统计靠右
.myCate .category-list-count {
  float: right;
  background-color: inherit;
  color: #999;
  font-weight: normal;
  line-height: 32px;
}
// 自定义分类下划线
.myCate .category-list-link {
  border-bottom: none;
  font-size: 0.8125em;
  flex: 1;
}
.myCate .category-list-count {
  font-size: 0.8125em;  
}
// 去除文章数量的括号
.myCate .category-list-count::before {
  content: '';
}
.myCate .category-list-count::after {
  content: '';
}
// 取消代码行数字,兼容横向滑动
.table-container .gutter {
  display: none !important;
}

更改分类中文章排序方式

_config.yml配置文件中进行调整

# Pagination
## Set per_page to 0 to disable pagination
per_page: 1000
pagination_dir: page
category_generator:
  order_by: sort

站点收录

百度搜索资源平台进行配置,同时安装sitemap生成工具,就能访问到站点地图

npm install hexo-generator-sitemap

站点地图地址为/sitemap.xml

CSS样式调整
网站名导航背景
固定页面宽度
关闭代码行数
美化滚动条
字体大小调整
取消顶部横条
图片增加边框
隐藏侧边作者名字
作者描述样式调整
文字选中颜色
取消代码块部分加粗
文章大纲美化
分类中多余图片
分类中月份处理
其他样式相关调整
自定义分类到侧边
更改分类中文章排序方式
站点收录