mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-08 15:10:37 +00:00
Merge pull request #2148 from KazooTTT/feat/distinguish-tags-by-color
feat: support whether to distinguish tags by color
This commit is contained in:
@@ -166,6 +166,7 @@ NEXT_PUBLIC_VERSION=4.3.1
|
|||||||
# NEXT_PUBLIC_NOTION_PROPERTY_TAGS=
|
# NEXT_PUBLIC_NOTION_PROPERTY_TAGS=
|
||||||
# NEXT_PUBLIC_NOTION_PROPERTY_ICON=
|
# NEXT_PUBLIC_NOTION_PROPERTY_ICON=
|
||||||
# NEXT_PUBLIC_ENABLE_RSS=
|
# NEXT_PUBLIC_ENABLE_RSS=
|
||||||
|
# NEXT_PUBLIC_IS_TAG_COLOR_DISTINGUISHED=
|
||||||
# MAILCHIMP_LIST_ID=
|
# MAILCHIMP_LIST_ID=
|
||||||
# MAILCHIMP_API_KEY=
|
# MAILCHIMP_API_KEY=
|
||||||
# NEXT_PUBLIC_DEBUG=
|
# NEXT_PUBLIC_DEBUG=
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ const BLOG = {
|
|||||||
APPEARANCE: process.env.NEXT_PUBLIC_APPEARANCE || 'light', // ['light', 'dark', 'auto'], // light 日间模式 , dark夜间模式, auto根据时间和主题自动夜间模式
|
APPEARANCE: process.env.NEXT_PUBLIC_APPEARANCE || 'light', // ['light', 'dark', 'auto'], // light 日间模式 , dark夜间模式, auto根据时间和主题自动夜间模式
|
||||||
APPEARANCE_DARK_TIME: process.env.NEXT_PUBLIC_APPEARANCE_DARK_TIME || [18, 6], // 夜间模式起至时间,false时关闭根据时间自动切换夜间模式
|
APPEARANCE_DARK_TIME: process.env.NEXT_PUBLIC_APPEARANCE_DARK_TIME || [18, 6], // 夜间模式起至时间,false时关闭根据时间自动切换夜间模式
|
||||||
|
|
||||||
|
IS_TAG_COLOR_DISTINGUISHED: process.env.NEXT_PUBLIC_IS_TAG_COLOR_DISTINGUISHED === 'true' || true, // 对于名称相同的tag是否区分tag的颜色
|
||||||
|
|
||||||
// 3.14.1版本后,欢迎语在此配置,英文逗号隔开 , 即可支持多个欢迎语打字效果。
|
// 3.14.1版本后,欢迎语在此配置,英文逗号隔开 , 即可支持多个欢迎语打字效果。
|
||||||
GREETING_WORDS: process.env.NEXT_PUBLIC_GREETING_WORDS || 'Hi,我是一个程序员, Hi,我是一个打工人,Hi,我是一个干饭人,欢迎来到我的博客🎉',
|
GREETING_WORDS: process.env.NEXT_PUBLIC_GREETING_WORDS || 'Hi,我是一个程序员, Hi,我是一个打工人,Hi,我是一个干饭人,欢迎来到我的博客🎉',
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { isIterable } from '../utils'
|
import { isIterable } from '../utils'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有文章的标签
|
* 获取所有文章的标签
|
||||||
@@ -24,14 +25,30 @@ export function getAllTags({ allPages, sliceCount = 0, tagOptions }) {
|
|||||||
tagObj[tag] = 1
|
tagObj[tag] = 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const list = []
|
const list = []
|
||||||
|
const { IS_TAG_COLOR_DISTINGUISHED } = BLOG
|
||||||
if (isIterable(tagOptions)) {
|
if (isIterable(tagOptions)) {
|
||||||
tagOptions.forEach(c => {
|
if (!IS_TAG_COLOR_DISTINGUISHED) {
|
||||||
const count = tagObj[c.value]
|
// 如果不区分颜色, 那么不同颜色相同名称的tag当做同一种tag
|
||||||
if (count) {
|
const savedTagNames = new Set()
|
||||||
list.push({ id: c.id, name: c.value, color: c.color, count })
|
tagOptions.forEach(c => {
|
||||||
}
|
if (!savedTagNames.has(c.value)) {
|
||||||
})
|
const count = tagObj[c.value]
|
||||||
|
if (count) {
|
||||||
|
list.push({ id: c.id, name: c.value, color: c.color, count })
|
||||||
|
}
|
||||||
|
savedTagNames.add(c.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
tagOptions.forEach(c => {
|
||||||
|
const count = tagObj[c.value]
|
||||||
|
if (count) {
|
||||||
|
list.push({ id: c.id, name: c.value, color: c.color, count })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按照数量排序
|
// 按照数量排序
|
||||||
|
|||||||
Reference in New Issue
Block a user