mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 23:04: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 ArticleTitle: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
|
||||||
const title = fileData.frontmatter?.title
|
const title = fileData.frontmatter?.title
|
||||||
if (title) {
|
const visible = fileData.frontmatter?.visible
|
||||||
|
if (title && visible) {
|
||||||
return <h1 class={classNames(displayClass, "article-title")}>{title}</h1>
|
return <h1 class={classNames(displayClass, "article-title")}>{title}</h1>
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
|||||||
@ -59,8 +59,9 @@ export default ((opts?: Partial<BreadcrumbOptions>) => {
|
|||||||
allFiles,
|
allFiles,
|
||||||
displayClass,
|
displayClass,
|
||||||
}: QuartzComponentProps) => {
|
}: QuartzComponentProps) => {
|
||||||
// Hide crumbs on root if enabled
|
const visible = fileData.frontmatter?.visible
|
||||||
if (options.hideOnRoot && fileData.slug === "index") {
|
// Hide crumbs on root if enabled or if visible is false
|
||||||
|
if ((options.hideOnRoot && fileData.slug === "index") || !visible) {
|
||||||
return <></>
|
return <></>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,8 +25,9 @@ export default ((opts?: Partial<ContentMetaOptions>) => {
|
|||||||
|
|
||||||
function ContentMetadata({ cfg, fileData, displayClass }: QuartzComponentProps) {
|
function ContentMetadata({ cfg, fileData, displayClass }: QuartzComponentProps) {
|
||||||
const text = fileData.text
|
const text = fileData.text
|
||||||
|
const visible = fileData.frontmatter?.visible
|
||||||
|
|
||||||
if (text) {
|
if (text && visible) {
|
||||||
const segments: (string | JSX.Element)[] = []
|
const segments: (string | JSX.Element)[] = []
|
||||||
|
|
||||||
if (fileData.dates) {
|
if (fileData.dates) {
|
||||||
|
|||||||
@ -4,8 +4,9 @@ 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 visible = fileData.frontmatter?.visible
|
||||||
const baseDir = pathToRoot(fileData.slug!)
|
const baseDir = pathToRoot(fileData.slug!)
|
||||||
if (tags && tags.length > 0) {
|
if (tags && tags.length > 0 && visible) {
|
||||||
return (
|
return (
|
||||||
<ul class={classNames(displayClass, "tags")}>
|
<ul class={classNames(displayClass, "tags")}>
|
||||||
{tags.map((tag) => {
|
{tags.map((tag) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user