This commit is contained in:
parent
2fa8800f15
commit
c7607067db
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user