improve path resolution stability
This commit is contained in:
parent
c874e7e937
commit
dd47be1bc6
@ -56,7 +56,7 @@ export function PageList({ fileData, allFiles, limit }: Props) {
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="internal tag-link"
|
class="internal tag-link"
|
||||||
href={resolveRelative(fileData.slug!, `tags/${tag}/index` as FullSlug)}
|
href={resolveRelative(fileData.slug!, `tags/${tag}` as FullSlug)}
|
||||||
>
|
>
|
||||||
#{tag}
|
#{tag}
|
||||||
</a>
|
</a>
|
||||||
|
@ -5,11 +5,11 @@ import path from "path"
|
|||||||
|
|
||||||
import style from "../styles/listPage.scss"
|
import style from "../styles/listPage.scss"
|
||||||
import { PageList } from "../PageList"
|
import { PageList } from "../PageList"
|
||||||
import { simplifySlug } from "../../util/path"
|
import { _stripSlashes, simplifySlug } from "../../util/path"
|
||||||
|
|
||||||
function FolderContent(props: QuartzComponentProps) {
|
function FolderContent(props: QuartzComponentProps) {
|
||||||
const { tree, fileData, allFiles } = props
|
const { tree, fileData, allFiles } = props
|
||||||
const folderSlug = simplifySlug(fileData.slug!)
|
const folderSlug = _stripSlashes(simplifySlug(fileData.slug!))
|
||||||
const allPagesInFolder = allFiles.filter((file) => {
|
const allPagesInFolder = allFiles.filter((file) => {
|
||||||
const fileSlug = simplifySlug(file.slug!)
|
const fileSlug = simplifySlug(file.slug!)
|
||||||
const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug
|
const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug
|
||||||
|
@ -25,7 +25,7 @@ export function pageResources(slug: FullSlug, staticResources: StaticResources):
|
|||||||
css: [joinSegments(baseDir, "index.css"), ...staticResources.css],
|
css: [joinSegments(baseDir, "index.css"), ...staticResources.css],
|
||||||
js: [
|
js: [
|
||||||
{
|
{
|
||||||
src: joinSegments(baseDir, "/prescript.js"),
|
src: joinSegments(baseDir, "prescript.js"),
|
||||||
loadTime: "beforeDOMReady",
|
loadTime: "beforeDOMReady",
|
||||||
contentType: "external",
|
contentType: "external",
|
||||||
},
|
},
|
||||||
@ -37,7 +37,7 @@ export function pageResources(slug: FullSlug, staticResources: StaticResources):
|
|||||||
},
|
},
|
||||||
...staticResources.js,
|
...staticResources.js,
|
||||||
{
|
{
|
||||||
src: baseDir + "/postscript.js",
|
src: joinSegments(baseDir, "postscript.js"),
|
||||||
loadTime: "afterDOMReady",
|
loadTime: "afterDOMReady",
|
||||||
moduleType: "module",
|
moduleType: "module",
|
||||||
contentType: "external",
|
contentType: "external",
|
||||||
|
@ -177,7 +177,7 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
|
|||||||
window.spaNavigate(new URL(targ, window.location.toString()))
|
window.spaNavigate(new URL(targ, window.location.toString()))
|
||||||
})
|
})
|
||||||
.on("mouseover", function (_, d) {
|
.on("mouseover", function (_, d) {
|
||||||
const neighbours: SimpleSlug[] = data[slug].links ?? []
|
const neighbours: SimpleSlug[] = data[fullSlug].links ?? []
|
||||||
const neighbourNodes = d3
|
const neighbourNodes = d3
|
||||||
.selectAll<HTMLElement, NodeData>(".node")
|
.selectAll<HTMLElement, NodeData>(".node")
|
||||||
.filter((d) => neighbours.includes(d.id))
|
.filter((d) => neighbours.includes(d.id))
|
||||||
|
@ -60,7 +60,8 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options> | undefined> =
|
|||||||
dest,
|
dest,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
)
|
)
|
||||||
const canonicalDest = path.posix.normalize(joinSegments(curSlug, dest))
|
const url = new URL(dest, `https://base.com/${curSlug}`)
|
||||||
|
const canonicalDest = url.pathname
|
||||||
const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
|
const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
|
||||||
const simple = simplifySlug(destCanonical as FullSlug)
|
const simple = simplifySlug(destCanonical as FullSlug)
|
||||||
outgoing.add(simple)
|
outgoing.add(simple)
|
||||||
|
Loading…
Reference in New Issue
Block a user