// create the hexo project hexo init <folder> cd <folder> npm install
/** * File Directory Structure * ├── _config.yml :Configuration information for the website * ├── package.json :Dependent files for the project * ├── scaffolds :Template folder * ├── source :A folder to store the resources (Files/folders with names beginning with _ and hidden files * | ├── _posts :will be ignored except for '_posts' folder) * | └── _drafts * └── themes */
beautify
I am going to modularize the entire page and describe the configurations of each section separately
// n_layout // password.swig <script src="https://cdn.staticfile.org/jquery/3.1.1/jquery.min.js"></script> <script> var div = $('.post-body'); //var toc=$('.post-toc-wrap') var toc=$('.nav') function password() { if('{{ page.password }}'){ div.remove(); toc.remove(); $('.post-header').after( '<span class="description" style="font-weight: bold;border: none;display: block;'+ 'width: 60%;margin: 0 auto;text-align: center;outline: none;margin-bottom: 40px;resize:none ">'+ 'Please Enter your password and press Enter to read' + '</span>' + '<div class="qiang" style="height: 100px;width: 60%;margin:0 auto">' + '<input class="password" type="password" autocomplete="new-password" autofocus="autofocus" value="" style="border-radius: 5px; height: 30px; display: block; margin: 0 auto; width: 95%; box-shadow: none; background-color: transparent; border: 1px solid rgba(255,255,255,0.5); color: rgba(255,255,255,0.5); outline: none; text-align: center;"/>' + '</div>')
document.onclick = function (event) { var e = event || window.event; var elem = e.srcElement || e.target;
while (elem) { if (elem != document) { if (elem.className == "password") { return; } elem = elem.parentNode; } else { return; } } }
$(document).keyup(function(event){ if(event.keyCode ==13&&$('.password').length>0){ if ($('.password').val() == '{{ page.password }}') {
(div).appendTo($(".post-header"))
toc.appendTo($(".post-toc")) var doms = document.getElementsByClassName("nav-child"); for(var i = 0; i < doms.length; i++){ doms[i].style.display="block"; }
// n_layout <main class="main"> ...... {% include 'password.swig' %} </main>
Add the password in the beginning of article
1
password: xxx
PostEnd
The end of the post
1 2 3 4 5 6 7 8 9
// themes/next/layout/_macro/passage-end-tag.swig
<div> {% if not is_index %} <div style="text-align:center;color: #ccc;font-size:14px;"> -------------The end of this article, thanks for reading------------- </div> {% endif %} </div>
1 2 3 4 5 6 7
// themes/next/layout/_macro/post.swig
<div> {% if not is_index %} {% include 'passage-end-tag.swig' %} {% endif %} </div>
Donate
1 2 3 4 5 6 7 8 9
# n_config
reward_settings: enable:true animation:false
reward: wechatpay:xxx.png alipay:xxx.png
End tag’s icons
1 2 3
# n_config
tag_icon:true
Footer
Icon between year and copyright info
1 2 3 4 5 6 7 8 9 10 11
# n_config
icon: # The heart icon in the middle name:fafa-heart animated:true # Change the color of icon, using Hex Code. color:"#ff0000"
# If not defined, `author` from Hexo `_config.yml` will be used. copyright:
# FancyBox is a tool that offers a nice and elegant way to add zooming functionality for images. fancybox:true # Vanilla JavaScript plugin for lazyloading images. lazyload:true