NGP
Is life always this hard or is it just when you're a kid
当你老了,回顾一生,就会发觉:什么时候出国读书,什么时候决定做第一份职业、何时选定了对象而恋爱、什么时候结婚,其实都是命运的巨变。只是当时站在三岔路口,眼见风云千樯,你作出选择的那一日,在日记上,相当沉闷和平凡,当时还以为是生命中普通的一天。
一. 修改post.ejs文件
不同的主题位置不一,Ctrl+f 找post.content ,应该就能找到。
notepad批量打开文件见:Notepad 插件&技巧&特殊技巧
在文件中添加如下代码至<%- post.content %>
之前。
1 2 3 4 5 6 7 8
| <!--Table of Contents begin--> <% if(post.toc == true){ %> <div id="toc" class="toc-article"> <strong class="toc-title">目录</strong> <%- toc(post.content,{list_number:false}) %> </div> <% } %> <!--Table of Contents end -->
|
二. 在对应.css
或.tyle
文件中增加样式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| .toc-article { background #eee; border: 1px solid #bbb; border-radius: 10px; margin: 1.5em 0 0.3em 1.5em; padding: 1.2em 1em 0 1em; max-width: 28% } .toc-title { font-size: 120% } #toc { line-height: 1em; font-size: 0.9em; float: right } .toc { padding: 0; margin: 1em; line-height: 1.8em }
ol{ list-style-type: none } .toc-child { margin-left: 1em }
|
三. 在文章中添加 toc: true
1 2 3 4 5 6
| --- title: sample date: sample name: 97年的顽石 toc: true ---
|
运行一下,完
This article just represents my own viewpoint. If there is something wrong, please correct me.