hexo-blog-encrypt
-
安装插件
$ npm install --save hexo-blog-encrypt
-
配置
站点配置文件
,添加# Security ## encrypt: enable: true
文章头部:
--- title: 标题 date: 时间 tags: 标签 password: 密码 abstract: 文章摘要,显示在博客首页 message: 密码输入框上面的描述性文字 ---
-
自定义
-
对TOC加密
<% 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 %>
-
修改加密模板
# Security ## encrypt: enable: true default_abstract: the content has been encrypted, enter the password to read. default_message: Please enter the password to read. default_template: <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> <div id="security"> <div class="input-container"> <input type="password" class="form-control" id="pass" placeholder=" {{message}} " /> <label for="pass"> {{message}} </label> <div class="bottom-line"></div> </div> </div> <div id="encrypt-blog" style="display:none"> {{content}} </div>
-
自定义
文章头部
--- title: hello world date: 2016-03-30 21:18:02 tags: - fdsfadsfa - fdsafsdaf password: Mike abstract: Welcome to my blog, enter password to read. message: Welcome to my blog, enter password to read. template: <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> <div id="security"> <div class="input-container"> <input type="password" class="form-control" id="pass" placeholder=" {{message}} " /> <label for="pass"> {{message}} </label> <div class="bottom-line"></div> </div> </div> <div id="encrypt-blog" style="display:none"> {{content}} </div> ---
-
网友评论