惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
C
Check Point Blog
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
SecWiki News
SecWiki News
有赞技术团队
有赞技术团队
Latest news
Latest news
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
Project Zero
Project Zero
H
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
腾讯CDC
P
Proofpoint News Feed
L
LINUX DO - 热门话题
C
Cisco Blogs
P
Palo Alto Networks Blog
Vercel News
Vercel News
P
Privacy International News Feed
爱范儿
爱范儿
Scott Helme
Scott Helme
L
Lohrmann on Cybersecurity
MyScale Blog
MyScale Blog
K
Kaspersky official blog
B
Blog RSS Feed
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
O
OpenAI News
博客园 - 叶小钗
量子位
T
Tenable Blog
C
Cybersecurity and Infrastructure Security Agency CISA
J
Java Code Geeks
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LINUX DO - 最新话题
F
Fortinet All Blogs
N
News | PayPal Newsroom
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 【当耐特】
N
News and Events Feed by Topic
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI

微风静语

用 codebase-memory-mcp 给 AI 编程加一层“代码记忆” EchoCraft - 专为独立开发者和小型团队打造的产品官网主题 Halo 站长必备:外链安全与流量分析神器——“链接工具箱”重磅升级! Halo插件开发:java17旧项目迁移至java21项目记录 Halo插件|一个面向创作者的多功能媒体处理工具集 分布式事务详解:从入门到精通 让你的网站初步适配PWA Halo主题 - 微浸:以轻量构建美学,用细节定义体验 深入理解Python爬虫技术:原理、实现与实践 Halo-2.20 新特性:自定义登录页面模版 vue3 中父子组件数据传输踩坑 将你的服务运维面板从宝塔替换为1panel Python实战项目:外星人入侵(源码分享) theme-hao主题适配友链自助提交插件 plugin-artalk 插件保姆级使用教程 plugin-blog-hao 插件部分功能演示 halo 插件开发踩坑记录(一) Thymeleaf 模版引擎语法浅记 信息洪流中的自我救赎 mac 系统里如何管理多个jdk版本 memso API 不完全指南 基础语法:从CPU角度看变量、数组、类型、运算、跳转、函数等语法 衡量个人成长 halo-theme-hao 主题魔改教程 分享一个魔改的 Artalk 评论系统邮件模版 halo-theme-hao 主题标签记录 开发一个 Halo2.0 的安全条跳转中台插件! Mac 软件推荐:使用 Mac 一年半来,我一直在用的软件! TypeScript教程---面向对象编程 软件版本命名规范 TypeScript教程---基础语法及编译设置 2024年家乡春季的第一场大雪 提问的智慧 基础篇:容器化部署技术 -—docker,从此摆脱多环境配置的苦恼! 普通本科的四年大学教育,给我带来了什么? 因果与平衡 程序的本质:代码是如何被执行的 软件开发者应该具备的基本提问素质 如何编写 Restful 风格的接口 探索力 Springboot入门基础篇 springboot中如何使用注解来实现aop Springboot项目生成接口文档方法 Java 实体代码生成器 lombok 的使用 深入 Java 泛型 分布式版本控制工具 git 的基本使用 如何搭建前后端分离的项目 初识Vue3--令人焕然一新的使用逻辑和代码组织方式! 浅谈前端发展史 为什么要学习数据结构和算法 关于富文本编辑器 wangeditor 在 vue2 项目中的使用
halo-theme-hao主题:artalk评论区美化
webjing · 2024-06-08 · via 微风静语

一、效果预览

artalk 评论区的功能确实很强大,但是有些样式的美观程度还是略逊于 twikko 的,因此在 theme-hao 主题的基础上参照 twikko 样式进行了一些修改,最终呈现的评论区样式如下:

{https://dream-chaser.oss-cn-beijing.aliyuncs.com/halo-blog-save/blogImg/artalk-dark1.png,https://dream-chaser.oss-cn-beijing.aliyuncs.com/halo-blog-save/blogImg/pinglunqu-dark.png}

亮色模式

pinglunqu-light.png

二、美化过程

美化的内容主要包括如下几点:

  • 表情栏的各个表情包的间距显示样式
  • 表情、图片上传、预览之间的显示样式
  • 登录时候的输入框美化
  • 评论和回复区域加入了边框
  • 时间、徽标、浏览器、操作系统标签美化
  • 代码展示区域美化
  • 评论区回复内容优化
  • 评论内容链接优化
  • 评论内容图片优化
  • 徽章显示修改

1、样式修改

在 theme-hao 主题的 themes/theme-hao/templates/assets/zhheo/custom.css 文件后边加入如下内容:

/*artalk 样式修改*/
[data-theme=dark] .atk-comment-wrap {
    border: 1px solid #3d3d3f !important;
    border-radius: 12px !important;
    margin-bottom: .5rem !important;
    background-color: #1b1c20;
}
.atk-comment-wrap {
    border: 1px solid #e3e8f7 !important;
    border-radius: 12px !important;
    margin-bottom: .5rem !important;
}
.atk-grp-switcher span{
    padding: 0 .6rem !important;
}
[data-theme=dark] .atk-main-editor .atk-header input{
    border-radius: 8px;
    border: 1px solid #3d3d3f;
    height: 34px;
    padding: 0 .3rem;
    margin: 0 .3rem;
}
.atk-main-editor .atk-header input{
    border-radius: 8px;
    border: 1px solid #3d3d3f;
    height: 34px;
    padding: 0 .3rem;
    margin: 0 .3rem;
}
[data-theme=light] .atk-main-editor .atk-header input{
    border-radius: 8px;
    border: 1px solid #e3e8f7;;
    height: 34px;
    padding: 0 .3rem;
    margin: 0 .3rem;
}

.atk-comment>.atk-main>.atk-body>.atk-reply-to{
    border: 1px solid var(--at-color-border) !important;
    border-radius: 8px;
}
.atk-comment>.atk-main>.atk-header .atk-date{
    background: var(--heo-secondbg);
    border: var(--style-border-always);
    padding: 0 8px ;
    border-radius: 8px;
    margin-right: 4px !important;
    color: var(--at-color-meta) !important;
    display: inline !important;
}

.atk-comment>.atk-main>.atk-header .atk-ua-wrap .ua-browser,.ua-os, .atk-region-badge{
    background: var(--heo-secondbg) !important;
    border: var(--style-border-always) !important;
    padding: 0 8px !important;
    border-radius: 8px !important;
    margin-right: 4px !important;
    color: var(--at-color-meta) !important;
    display: inline !important;
}
.atk-comment>.atk-main>.atk-header .atk-badge{
    border: var(--style-border-always) !important;
    padding: 0 8px !important;
    border-radius: 8px !important;
    margin-right: 4px !important;
}
.artalk pre code {
    background: var(--heo-secondbg) !important;
    border-radius: 12px;
    border: var(--style-border-always);
}
.atk-comment-children>.atk-comment-wrap>.atk-comment {
    padding: 6px !important;
}
.atk-comment>.atk-main>.atk-body>.atk-content a:not(.fancybox){
    background: var(--heo-secondbg);
    border: var(--style-border-always);
    padding: 0 8px;
    border-radius: 8px;
    display: inline;
}
.atk-comment>.atk-main>.atk-body>.atk-content a:not(.fancybox)::after{
    content: " 🔗";
}
.atk-comment>.atk-main>.atk-body>.atk-content img{
    border-radius: 12px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

2、修改徽章

找到用户选型并对选中的用户进行编辑,在如下界面中进行修改徽章文字和颜色:

setting-badge.png

三 评论区加入数学公式

theme-hao 主题并没有默认加入数学公式显示功能,如果想要使用该功能只能自行加入,或者使用我开发的 artalk评路区 插件开启数学公式支持进行使用。效果如下:

shuxuegongshi.png

在 theme-hao 主题中,加入方式如下。只不过需要注意资源加载次序的问题,所以有很多同学自己在主题里边引入数学公式总是报错或者功能无法正常显示。

步骤一:

themes/theme-hao/templates/modules/comment/Artalk.html 文件中找到如下内容

<div class="js-pjax">
     <script th:src="${assets_link + '/js/comment/artalk.js'}"></script>
     <input type="hidden" name="page-type" id="page-type" value="album">
</div>

接着在该代码上边引入 katex 相关资源,注意css资源不要下载到本地进行替换,使用在线资源即可,不然会缺失一些在线字体样式,katex.min.js 文件下载到本地引入,具体路径和引入代码中的保持一致即可。

!-- 引入 Katex css -->
<link rel="stylesheet" href="https://unpkg.com/katex@0.16.7/dist/katex.min.css" />
<script data-pjax th:src="${assets_link + '/libs/artalk/katex.min.js'}"></script>

步骤二:

找到文件 themes/theme-hao/templates/assets/js/comment/artalk.js ,在文件中找到如下代码:

const loadArtalk = async () => {
        if (typeof window.artalkItem === 'object') initArtalk()
        else {
            await getCSS(GLOBAL_CONFIG.source.artalk.css)
            await getScript(GLOBAL_CONFIG.source.artalk.js)
            initArtalk()
        }
    }

之后必须在 await getScript(GLOBAL_CONFIG.source.artalk.js) 后边加入如下代码:

await getScript("https://unpkg.com/@artalk/plugin-katex/dist/artalk-plugin-katex.js");

步骤三:

themes/theme-hao/templates/modules/comment/Artalk.html 文件中找到如下内容,在 artalk.js 加入版本号防止缓存而导致的不生效问题。

<div class="js-pjax">
     <script th:src="${assets_link + '/js/comment/artalk.js'}"></script>
     <input type="hidden" name="page-type" id="page-type" value="album">
</div>

替换后如下:

<div class="js-pjax">
        <script th:src="${assets_link + '/js/comment/artalk.js' + theme_version}"></script>
        <input type="hidden" name="page-type" id="page-type" value="album">
    </div>

至此,你的评论区便可以支持数学公式了,希望我的记录对你有所帮助!