mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-24 08:39:01 +00:00
base path refactor to better support subpath hosting
This commit is contained in:
parent
3201f83b70
commit
c874e7e937
29 changed files with 257 additions and 389 deletions
quartz/components
|
@ -1,9 +1,9 @@
|
|||
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||
import style from "./styles/backlinks.scss"
|
||||
import { canonicalizeServer, resolveRelative } from "../util/path"
|
||||
import { resolveRelative, simplifySlug } from "../util/path"
|
||||
|
||||
function Backlinks({ fileData, allFiles }: QuartzComponentProps) {
|
||||
const slug = canonicalizeServer(fileData.slug!)
|
||||
const slug = simplifySlug(fileData.slug!)
|
||||
const backlinkFiles = allFiles.filter((file) => file.links?.includes(slug))
|
||||
return (
|
||||
<div class="backlinks">
|
||||
|
@ -12,7 +12,7 @@ function Backlinks({ fileData, allFiles }: QuartzComponentProps) {
|
|||
{backlinkFiles.length > 0 ? (
|
||||
backlinkFiles.map((f) => (
|
||||
<li>
|
||||
<a href={resolveRelative(slug, canonicalizeServer(f.slug!))} class="internal">
|
||||
<a href={resolveRelative(fileData.slug!, f.slug!)} class="internal">
|
||||
{f.frontmatter?.title}
|
||||
</a>
|
||||
</li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue