fix relative path resolution in router and link crawling
This commit is contained in:
		
							parent
							
								
									232652149a
								
							
						
					
					
						commit
						2f6747b166
					
				
					 44 changed files with 160 additions and 106 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
 | 
			
		||||
import style from "./styles/backlinks.scss"
 | 
			
		||||
import { canonicalizeServer, resolveRelative } from "../path"
 | 
			
		||||
import { canonicalizeServer, resolveRelative } from "../util/path"
 | 
			
		||||
 | 
			
		||||
function Backlinks({ fileData, allFiles }: QuartzComponentProps) {
 | 
			
		||||
  const slug = canonicalizeServer(fileData.slug!)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import { canonicalizeServer, pathToRoot } from "../path"
 | 
			
		||||
import { JSResourceToScriptElement } from "../resources"
 | 
			
		||||
import { canonicalizeServer, pathToRoot } from "../util/path"
 | 
			
		||||
import { JSResourceToScriptElement } from "../util/resources"
 | 
			
		||||
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
 | 
			
		||||
 | 
			
		||||
export default (() => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../path"
 | 
			
		||||
import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../util/path"
 | 
			
		||||
import { QuartzPluginData } from "../plugins/vfile"
 | 
			
		||||
import { Date } from "./Date"
 | 
			
		||||
import { QuartzComponentProps } from "./types"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
import { canonicalizeServer, pathToRoot } from "../path"
 | 
			
		||||
import { canonicalizeServer, pathToRoot } from "../util/path"
 | 
			
		||||
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
 | 
			
		||||
 | 
			
		||||
function PageTitle({ fileData, cfg }: QuartzComponentProps) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
import { canonicalizeServer, pathToRoot, slugTag } from "../path"
 | 
			
		||||
import { canonicalizeServer, pathToRoot, slugTag } from "../util/path"
 | 
			
		||||
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
 | 
			
		||||
 | 
			
		||||
function TagList({ fileData }: QuartzComponentProps) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ import path from "path"
 | 
			
		|||
 | 
			
		||||
import style from "../styles/listPage.scss"
 | 
			
		||||
import { PageList } from "../PageList"
 | 
			
		||||
import { canonicalizeServer } from "../../path"
 | 
			
		||||
import { canonicalizeServer } from "../../util/path"
 | 
			
		||||
 | 
			
		||||
function FolderContent(props: QuartzComponentProps) {
 | 
			
		||||
  const { tree, fileData, allFiles } = props
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ import { Fragment, jsx, jsxs } from "preact/jsx-runtime"
 | 
			
		|||
import { toJsxRuntime } from "hast-util-to-jsx-runtime"
 | 
			
		||||
import style from "../styles/listPage.scss"
 | 
			
		||||
import { PageList } from "../PageList"
 | 
			
		||||
import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes } from "../../path"
 | 
			
		||||
import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes } from "../../util/path"
 | 
			
		||||
import { QuartzPluginData } from "../../plugins/vfile"
 | 
			
		||||
 | 
			
		||||
const numPages = 10
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,8 +2,8 @@ import { render } from "preact-render-to-string"
 | 
			
		|||
import { QuartzComponent, QuartzComponentProps } from "./types"
 | 
			
		||||
import HeaderConstructor from "./Header"
 | 
			
		||||
import BodyConstructor from "./Body"
 | 
			
		||||
import { JSResourceToScriptElement, StaticResources } from "../resources"
 | 
			
		||||
import { CanonicalSlug, pathToRoot } from "../path"
 | 
			
		||||
import { JSResourceToScriptElement, StaticResources } from "../util/resources"
 | 
			
		||||
import { CanonicalSlug, pathToRoot } from "../util/path"
 | 
			
		||||
 | 
			
		||||
interface RenderComponents {
 | 
			
		||||
  head: QuartzComponent
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import type { ContentDetails } from "../../plugins/emitters/contentIndex"
 | 
			
		||||
import * as d3 from "d3"
 | 
			
		||||
import { registerEscapeHandler, removeAllChildren } from "./util"
 | 
			
		||||
import { CanonicalSlug, getCanonicalSlug, getClientSlug, resolveRelative } from "../../path"
 | 
			
		||||
import { CanonicalSlug, getCanonicalSlug, getClientSlug, resolveRelative } from "../../util/path"
 | 
			
		||||
 | 
			
		||||
type NodeData = {
 | 
			
		||||
  id: CanonicalSlug
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import { Document } from "flexsearch"
 | 
			
		||||
import { ContentDetails } from "../../plugins/emitters/contentIndex"
 | 
			
		||||
import { registerEscapeHandler, removeAllChildren } from "./util"
 | 
			
		||||
import { CanonicalSlug, getClientSlug, resolveRelative } from "../../path"
 | 
			
		||||
import { CanonicalSlug, getClientSlug, resolveRelative } from "../../util/path"
 | 
			
		||||
 | 
			
		||||
interface Item {
 | 
			
		||||
  id: number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import micromorph from "micromorph"
 | 
			
		||||
import { CanonicalSlug, RelativeURL, getCanonicalSlug } from "../../path"
 | 
			
		||||
import { CanonicalSlug, RelativeURL, getCanonicalSlug } from "../../util/path"
 | 
			
		||||
 | 
			
		||||
// adapted from `micromorph`
 | 
			
		||||
// https://github.com/natemoo-re/micromorph
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue