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