当前位置: 首页 > news >正文

【Hexo】4.Hexo 博客文章进行加密

安装

npm install --save hexo-blog-encrypt

1-快速使用

将“ password”添加到您的文章信息头就像这样:

password: 123456
---

2-按标签加密

1.修改文章信息头如下:

title: Hello World
tags:
- 加密文章tag
date: 2020-03-13 21:12:21
password: muyiio
abstract: 这里有东西被加密了,需要输入密码查看哦。
message: 您好,这里需要密码。
wrong_pass_message: 抱歉,这个密码看着不太对,请再试试。
wrong_hash_message: 抱歉,这个文章不能被纠正,不过您还是能看看解密后的内容。

2.对博客根目录_config添加如下字段:

# 安全
encrypt: # hexo-blog-encryptabstract: 这里有东西被加密了,需要输入密码查看哦。message: 您好, 这里需要密码.tags:- {name: tagName, password: 密码A}- {name: tagName, password: 密码B}template: <div id="hexo-blog-encrypt" data-wpm="{{hbeWrongPassMessage}}" data-whm="{{hbeWrongHashMessage}}"><div class="hbe-input-container"><input type="password" id="hbePass" placeholder="{{hbeMessage}}" /><label>{{hbeMessage}}</label><div class="bottom-line"></div></div><script id="hbeData" type="hbeData" data-hmacdigest="{{hbeHmacDigest}}">{{hbeEncryptedData}}</script></div>wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试.wrong_hash_message: 抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容.

3-TOC 文章进行加密

  1. 在hexo/themes/matery/layout/_partial/article.ejs找到article.ejs
  2. 然后找到<%post.content%>这段代码,通常在30行左右
  3. 使用如下的代码来替代它:
<% if(post.toc == true){ %><div id="toc-div" class="toc-article" <% if (post.encrypt == true) { %>style="display:none" <% } %>><strong class="toc-title">Index</strong><% if (post.encrypt == true) { %><%- toc(post.origin, {list_number: true}) %><% } else { %><%- toc(post.content, {list_number: true}) %><% } %></div>
<% } %>
<%- post.content %>
http://www.xdnf.cn/news/760555.html

相关文章:

  • python汉语编程,将关键字与文言文对应
  • Claude 4 升级:从问答助手到任务执行者 | AI大咖说
  • Python入门手册:类和对象
  • Spring是如何实现属性占位符解析
  • 如何下载python的第三方类库
  • Day 36训练
  • Linux epel-release 详解
  • 多线程——定时任务ScheduledThreadPoolExecutor用法
  • 深度学习---负样本训练
  • 字符串相关的方法有哪些?
  • 基于LLM的智能客服系统开发全流程:技术架构、落地挑战与行业实践
  • 智能体觉醒:AI开始自己“动手”了-自主进化开启任务革命时代
  • 【强化学习哲学 Day 1】Q-Learning - 在不确定中寻找确定
  • ​​技术深度解析:《鸿蒙5.0+:AI驱动的全场景功耗革命》​
  • 智慧交通设计方案
  • Docker安装mitproxy
  • Vue组件定义
  • 中国高分辨率高质量地面CO数据集(2013-2023)
  • C++:回调函数
  • duilib图片属性中corner属性九宫格拉伸说明
  • DQN和DDQN(进阶版)
  • 跨平台猫咪桌宠 BongoCat v0.4.0 绿色版
  • AdaCtrl:自适应可控Reasoning,可降10~90%推理长度!!
  • 模拟实现线程池(线程数目为定值)和定时器
  • 告别手动绘图!基于AI的Smart Mermaid自动可视化图表工具搭建与使用指南
  • 【python深度学习】Day 42 Grad-CAM与Hook函数
  • [学习] PID算法原理与实践(代码示例)
  • 高速串行接口
  • ESG体系
  • Cursor 中三个选项 Agent 、 Ask 和 Manual 含义