NGP
Is life always this hard or is it just when you're a kid
当你老了,回顾一生,就会发觉:什么时候出国读书,什么时候决定做第一份职业、何时选定了对象而恋爱、什么时候结婚,其实都是命运的巨变。只是当时站在三岔路口,眼见风云千樯,你作出选择的那一日,在日记上,相当沉闷和平凡,当时还以为是生命中普通的一天。
我的博客采用的是: 标签简单分3类,用标签代替任何 【更细分的分类】
一. Hexo 自动生成 Tag Cloud 标签云页面
在/layout/.../tags.ejs
添加:
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| <% if (page.path === "tags/index.html"){ %> <hr> <br> <%- list_categories({ depth: 1, }) %> <div class="tags"> <%- tagcloud({ min_font: 16, max_font: 35, amount: 999, color: true, start_color: 'gray', end_color: 'black', }) %> </div> <style> .category-list li{ display: inline-block; margin: 0 1em .5em 0; padding: 4px; border: 1px solid lightgray; font-size: 1.2em; } .category-list a { color: gray; } .category-list-item:hover a { color: gray; text-decoration: none; font-weight: bold; } .category-list-count { margin-left: 2px; font-size: .9em; } .article-entry ul li:before{ display: none; } .article-inner { text-align: center; } .tags { max-width: 40em; margin: 2em auto; margin-top: 0em; } .tags a { margin-right: 1em; border-bottom: 1px solid gray; line-height: 65px; white-space: nowrap; } .tags a:hover { border-bottom: 2px solid black; font-style: italic; text-decoration: none; } </style> <% } %>
|
二. 彩色标签云 (这种方式会让原来的样式消失)
修改 tagcloud部分如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <%- tagcloud({ min_font: 16, max_font: 40, amount: 999, color: true, start_color: 'gray', end_color: 'red', }) %> <script type="text/javascript"> var list = document.querySelectorAll('.tagscloud a'); Array.prototype.forEach.call(list, (item, index) => { S = "90"; L = "49"; item.style.color = "hsl(" + Math.round(Math.random() * 360) + "," + S + '%,' + L + '%)'; }); </script>
|
This article just represents my own viewpoint. If there is something wrong, please correct me.