diff --git a/layout/page.pug b/layout/page.pug
index 16c061e..31324e1 100644
--- a/layout/page.pug
+++ b/layout/page.pug
@@ -7,7 +7,7 @@ block content
| -
span.tag-cloud__amount= site.tags.length
.tag-cloud-tags
- !=cloudTags({source: site.tags, minfontsize: 1, maxfontsize: 2.1, limit: 0, unit: 'em'})
+ !=cloudTags({source: site.tags, minfontsize: 1.2, maxfontsize: 2.1, limit: 0, unit: 'em'})
if page.comments !== false && theme.comments && theme.comments.use
- var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})
diff --git a/layout/tag.pug b/layout/tag.pug
index 9f39ff8..9f99658 100644
--- a/layout/tag.pug
+++ b/layout/tag.pug
@@ -3,7 +3,7 @@ extends includes/layout.pug
block content
if theme.tag_ui == 'index'
include ./includes/mixins/post-ui.pug
- #recent-posts.recent-posts
+ #recent-posts.recent-posts
+postUI
include includes/pagination.pug
else
diff --git a/package.json b/package.json
index 3cca2fc..36c6e30 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
- "version": "3.2.0-b3",
+ "version": "3.2.0-b4",
"description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {
diff --git a/scripts/helpers/page.js b/scripts/helpers/page.js
index dc73ef0..f83f08e 100644
--- a/scripts/helpers/page.js
+++ b/scripts/helpers/page.js
@@ -34,19 +34,32 @@ hexo.extend.helper.register('injectHtml', function (data) {
hexo.extend.helper.register('cloudTags', function (options = {}) {
const env = this
- const source = options.source
+ let source = options.source
const minfontsize = options.minfontsize
const maxfontsize = options.maxfontsize
const limit = options.limit
const unit = options.unit || 'px'
let result = ''
- const tagLimit = limit === 0 ? source.length : limit
- source.sort('name').limit(tagLimit).forEach(function (tags) {
- const fontSizeRD = Math.random() * (maxfontsize - minfontsize) + minfontsize
- const fontSize = fontSizeRD.toFixed(2) + unit
+ if (limit > 0) {
+ source = source.limit(limit)
+ }
+
+ const sizes = []
+ source.sort('length').forEach(tag => {
+ const { length } = tag
+ if (sizes.includes(length)) return
+ sizes.push(length)
+ })
+
+ const length = sizes.length - 1
+ source.forEach(tag => {
+ const ratio = length ? sizes.indexOf(tag.length) / length : 0
+ const size = minfontsize + ((maxfontsize - minfontsize) * ratio)
+ let style = `font-size: ${parseFloat(size.toFixed(2))}${unit};`
const color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200
- result += `${tags.name}`
+ style += ` color: ${color}`
+ result += `${tag.name}`
})
return result
})
diff --git a/source/css/_page/categories.styl b/source/css/_page/categories.styl
index 5591de4..3f668ca 100644
--- a/source/css/_page/categories.styl
+++ b/source/css/_page/categories.styl
@@ -9,6 +9,9 @@
text-align: center
font-size: 2.57em
+ +maxWidth768()
+ font-size: 2em
+
.category-list
a
color: var(--font-color)
diff --git a/source/css/_page/tags.styl b/source/css/_page/tags.styl
index f3ff325..4e3eba6 100644
--- a/source/css/_page/tags.styl
+++ b/source/css/_page/tags.styl
@@ -10,5 +10,11 @@
color: $text-hover !important
transform: scale(1.1)
+ +maxWidth768()
+ zoom: .85
+
&__title
font-size: 2.57em
+
+ +maxWidth768()
+ font-size: 2em