Compare commits
2 Commits
455acb3b74
...
30af32532c
| Author | SHA1 | Date | |
|---|---|---|---|
| 30af32532c | |||
| 3d95f73093 |
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,11 +0,0 @@
|
||||
.DS_Store
|
||||
.gitignore
|
||||
node_modules
|
||||
public
|
||||
prof
|
||||
tsconfig.tsbuildinfo
|
||||
.obsidian
|
||||
.quartz-cache
|
||||
private/
|
||||
.replit
|
||||
replit.nix
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"syncToken": "s16_124_12_8_23_1_33_29_0_1_1",
|
||||
"filter": null,
|
||||
"appserviceUsers": {},
|
||||
"appserviceTransactions": {},
|
||||
"kvStore": {}
|
||||
}
|
||||
4957
pnpm-lock.yaml
generated
4957
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,11 @@
|
||||
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||
import { classNames } from "../util/lang"
|
||||
import { deslugify } from "../util/path"
|
||||
|
||||
const ArticleTitle: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
|
||||
const title = fileData.frontmatter?.title
|
||||
if (title) {
|
||||
return <h1 class={classNames(displayClass, "article-title")}>{title}</h1>
|
||||
return <h1 class={classNames(displayClass, "article-title")}>{title == 'index' ? deslugify(fileData.slug!, 2) : title}</h1>
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FullSlug, isFolderPath, resolveRelative } from "../util/path"
|
||||
import { deslugify, FullSlug, isFolderPath, resolveRelative } from "../util/path"
|
||||
import { QuartzPluginData } from "../plugins/vfile"
|
||||
import { Date, getDate } from "./Date"
|
||||
import { QuartzComponent, QuartzComponentProps } from "./types"
|
||||
@ -79,7 +79,7 @@ export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit, sort
|
||||
<div class="desc">
|
||||
<h3>
|
||||
<a href={resolveRelative(fileData.slug!, page.slug!)} class="internal">
|
||||
{title}
|
||||
{title == "index" ? deslugify(page.slug!) : title}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
@ -4,7 +4,7 @@ import { classNames } from "../util/lang"
|
||||
import { i18n } from "../i18n"
|
||||
|
||||
const PageTitle: QuartzComponent = ({ fileData, cfg, displayClass }: QuartzComponentProps) => {
|
||||
const title = cfg?.pageTitle ?? i18n(cfg.locale).propertyDefaults.title
|
||||
const title = cfg?.pageTitle ?? fileData.slug
|
||||
const baseDir = pathToRoot(fileData.slug!)
|
||||
return (
|
||||
<h2 class={classNames(displayClass, "page-title")}>
|
||||
|
||||
@ -54,7 +54,7 @@ export function getFullSlug(window: Window): FullSlug {
|
||||
return res
|
||||
}
|
||||
|
||||
function sluggify(s: string): string {
|
||||
function sluggify(s: FullSlug): string {
|
||||
return s
|
||||
.split("/")
|
||||
.map((segment) =>
|
||||
@ -69,6 +69,17 @@ function sluggify(s: string): string {
|
||||
.replace(/\/$/, "")
|
||||
}
|
||||
|
||||
export function deslugify(slug: string, dirs?: number): string {
|
||||
const sliceStart = dirs === undefined ? -2 : -1 - dirs
|
||||
|
||||
return slug
|
||||
.split("/")
|
||||
.slice(sliceStart,-1)
|
||||
.join(": ")
|
||||
.replace(/-and-/g, "&")
|
||||
.replace(/-/g, " ")
|
||||
}
|
||||
|
||||
export function slugifyFilePath(fp: FilePath, excludeExt?: boolean): FullSlug {
|
||||
fp = stripSlashes(fp) as FilePath
|
||||
let ext = getFileExtension(fp)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user