update Tags
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Struchkov Mark 2024-09-07 23:43:08 +03:00
parent 04b9cff4fe
commit 7438fca363
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C

View File

@ -4,25 +4,27 @@ import { classNames } from "../util/lang"
const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
const tags = fileData.frontmatter?.tags
const enableTags = fileData.frontmatter?.enableTags ?? true
const baseDir = pathToRoot(fileData.slug!)
if (tags && tags.length > 0) {
return (
<ul class={classNames(displayClass, "tags")}>
{tags.map((tag) => {
const linkDest = baseDir + `/tags/${slugTag(tag)}`
return (
<li>
<a href={linkDest} class="internal tag-link">
{tag}
</a>
</li>
)
})}
</ul>
)
} else {
if (enableTags === false || !tags || tags.length === 0) {
return null
}
return (
<ul class={classNames(displayClass, "tags")}>
{tags.map((tag) => {
const linkDest = baseDir + `/tags/${slugTag(tag)}`
return (
<li key={tag}>
<a href={linkDest} class="internal tag-link">
{tag}
</a>
</li>
)
})}
</ul>
)
}
TagList.css = `