This commit is contained in:
parent
04b9cff4fe
commit
7438fca363
@ -4,14 +4,19 @@ import { classNames } from "../util/lang"
|
|||||||
|
|
||||||
const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
|
const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
|
||||||
const tags = fileData.frontmatter?.tags
|
const tags = fileData.frontmatter?.tags
|
||||||
|
const enableTags = fileData.frontmatter?.enableTags ?? true
|
||||||
const baseDir = pathToRoot(fileData.slug!)
|
const baseDir = pathToRoot(fileData.slug!)
|
||||||
if (tags && tags.length > 0) {
|
|
||||||
|
if (enableTags === false || !tags || tags.length === 0) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul class={classNames(displayClass, "tags")}>
|
<ul class={classNames(displayClass, "tags")}>
|
||||||
{tags.map((tag) => {
|
{tags.map((tag) => {
|
||||||
const linkDest = baseDir + `/tags/${slugTag(tag)}`
|
const linkDest = baseDir + `/tags/${slugTag(tag)}`
|
||||||
return (
|
return (
|
||||||
<li>
|
<li key={tag}>
|
||||||
<a href={linkDest} class="internal tag-link">
|
<a href={linkDest} class="internal tag-link">
|
||||||
{tag}
|
{tag}
|
||||||
</a>
|
</a>
|
||||||
@ -20,9 +25,6 @@ const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentPro
|
|||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TagList.css = `
|
TagList.css = `
|
||||||
|
Loading…
Reference in New Issue
Block a user