D0n9X1n / hexo-blog-encrypt

Yet, just another hexo plugin for security.
https://www.npmjs.com/package/hexo-blog-encrypt
MIT License
971 stars 101 forks source link

能不能设置只隐藏部分content? #134

Closed chinobing closed 4 years ago

chinobing commented 4 years ago

如题

D0n9X1n commented 4 years ago

不支持。

如果涉及复杂需求,最好用 wordpress。

chinobing commented 4 years ago

不支持。

如果涉及复杂需求,最好用 wordpress。

明白,大概是hexo的template构成有关。 我估计要修改template,然后修改这个插件的指定生成区域,应该可以?

D0n9X1n commented 4 years ago

有一个偏方可以试试,你把内容写在 template 里面 = =

参考 https://github.com/MikeCoder/hexo-blog-encrypt#example ,把 template 配置改为:

<div>
博客内容。。。
</div>

<div id="hexo-blog-encrypt" data-wpm="{{hbeWrongPassMessage}}" data-whm="{{hbeWrongHashMessage}}">
  <div class="hbe-input-container">
  <input type="password" id="hbePass" placeholder="" />
    <label for="hbePass">{{hbeMessage}}</label>
    <div class="bottom-line"></div>
  </div>
  <script id="hbeData" type="hbeData" data-hmacdigest="{{hbeHmacDigest}}">{{hbeEncryptedData}}</script>
</div>

<div>
博客内容。。。
</div>

如果要支持这个功能的话,纯文本还行,如果内容里有懒加载图片,特效之类的,就没法弄了。全文加密还可以跑一遍 onload,部分的话,就需要手动加各种 js 了。