Jacky Zhao
2023-06-03 4bdc17d4a11f0ba517c6d9124d296458332c536b
quartz/path.ts
@@ -22,11 +22,15 @@
// resolve /a/b/c to ../../
export function resolveToRoot(slug: string): string {
  let fp = slug
  if (fp.endsWith("/index")) {
    fp = fp.slice(0, -"/index".length)
  if (fp.endsWith("index")) {
    fp = fp.slice(0, -"index".length)
  }
  return fp
  if (fp === "") {
    return "."
  }
  return "./" + fp
    .split('/')
    .filter(x => x !== '')
    .map(_ => '..')