fixed Backlinks.tsx
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2024-09-05 00:58:39 +03:00
parent 2fa8800f15
commit c7607067db
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C

View File

@ -12,24 +12,20 @@ const Backlinks: QuartzComponent = ({
}: QuartzComponentProps) => { }: QuartzComponentProps) => {
const slug = simplifySlug(fileData.slug!) const slug = simplifySlug(fileData.slug!)
const backlinkFiles = allFiles.filter((file) => file.links?.includes(slug)) const backlinkFiles = allFiles.filter((file) => file.links?.includes(slug))
return ( return backlinkFiles.length <= 0 ? null : (
<div class={classNames(displayClass, "backlinks")}> <div class={classNames(displayClass, "backlinks")}>
<h3>{i18n(cfg.locale).components.backlinks.title}</h3> <h3>{i18n(cfg.locale).components.backlinks.title}</h3>
<ul class="overflow"> <ul class="overflow">
{backlinkFiles.length > 0 ? ( {backlinkFiles.map((f) => (
backlinkFiles.map((f) => ( <li key={f.slug}>
<li> <a href={resolveRelative(fileData.slug!, f.slug!)} class="internal">
<a href={resolveRelative(fileData.slug!, f.slug!)} class="internal"> {f.frontmatter?.title}
{f.frontmatter?.title} </a>
</a> </li>
</li> ))}
))
) : (
<li>{i18n(cfg.locale).components.backlinks.noBacklinksFound}</li>
)}
</ul> </ul>
</div> </div>
) );
} }
Backlinks.css = style Backlinks.css = style