mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 14:54:05 -06:00
feat(frontmatter)-visibility_visibility-checking-in-beforebody
This commit is contained in:
parent
4bc8834f25
commit
05fcdf4938
@ -3,7 +3,8 @@ import { classNames } from "../util/lang"
|
||||
|
||||
const ArticleTitle: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
|
||||
const title = fileData.frontmatter?.title
|
||||
if (title) {
|
||||
const visible = fileData.frontmatter?.visible
|
||||
if (title && visible) {
|
||||
return <h1 class={classNames(displayClass, "article-title")}>{title}</h1>
|
||||
} else {
|
||||
return null
|
||||
|
||||
@ -59,8 +59,9 @@ export default ((opts?: Partial<BreadcrumbOptions>) => {
|
||||
allFiles,
|
||||
displayClass,
|
||||
}: QuartzComponentProps) => {
|
||||
// Hide crumbs on root if enabled
|
||||
if (options.hideOnRoot && fileData.slug === "index") {
|
||||
const visible = fileData.frontmatter?.visible
|
||||
// Hide crumbs on root if enabled or if visible is false
|
||||
if ((options.hideOnRoot && fileData.slug === "index") || !visible) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@ -25,8 +25,9 @@ export default ((opts?: Partial<ContentMetaOptions>) => {
|
||||
|
||||
function ContentMetadata({ cfg, fileData, displayClass }: QuartzComponentProps) {
|
||||
const text = fileData.text
|
||||
const visible = fileData.frontmatter?.visible
|
||||
|
||||
if (text) {
|
||||
if (text && visible) {
|
||||
const segments: (string | JSX.Element)[] = []
|
||||
|
||||
if (fileData.dates) {
|
||||
|
||||
@ -4,8 +4,9 @@ import { classNames } from "../util/lang"
|
||||
|
||||
const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
|
||||
const tags = fileData.frontmatter?.tags
|
||||
const visible = fileData.frontmatter?.visible
|
||||
const baseDir = pathToRoot(fileData.slug!)
|
||||
if (tags && tags.length > 0) {
|
||||
if (tags && tags.length > 0 && visible) {
|
||||
return (
|
||||
<ul class={classNames(displayClass, "tags")}>
|
||||
{tags.map((tag) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user