mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-19 22:29:16 +00:00
basic search implementation
This commit is contained in:
parent
c4cf0dcb02
commit
fd5c8d17d3
26 changed files with 751 additions and 182 deletions
quartz/components
19
quartz/components/Backlinks.tsx
Normal file
19
quartz/components/Backlinks.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||
import style from "./styles/backlinks.scss"
|
||||
import { relativeToRoot } from "../path"
|
||||
|
||||
function Backlinks({ fileData, allFiles }: QuartzComponentProps) {
|
||||
const slug = fileData.slug!
|
||||
const backlinkFiles = allFiles.filter(file => file.links?.includes(slug))
|
||||
return <div class="backlinks">
|
||||
<h3>Backlinks</h3>
|
||||
<ul>
|
||||
{backlinkFiles.length > 0 ?
|
||||
backlinkFiles.map(f => <li><a href={relativeToRoot(slug, f.slug!)} class="internal">{f.frontmatter?.title}</a></li>)
|
||||
: <li>No backlinks found</li>}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
Backlinks.css = style
|
||||
export default (() => Backlinks) satisfies QuartzComponentConstructor
|
Loading…
Add table
Add a link
Reference in a new issue