mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-19 19:04:06 -06:00
cleanup
This commit is contained in:
parent
119e71d06e
commit
1275fdf1a2
@ -41,7 +41,7 @@ This part of the configuration concerns anything that can affect the whole site.
|
|||||||
- This should also include the subpath if you are [[hosting]] on GitHub pages without a custom domain. For example, if my repository is `jackyzha0/quartz`, GitHub pages would deploy to `https://jackyzha0.github.io/quartz` and the `baseUrl` would be `jackyzha0.github.io/quartz`.
|
- This should also include the subpath if you are [[hosting]] on GitHub pages without a custom domain. For example, if my repository is `jackyzha0/quartz`, GitHub pages would deploy to `https://jackyzha0.github.io/quartz` and the `baseUrl` would be `jackyzha0.github.io/quartz`.
|
||||||
- Note that Quartz 4 will avoid using this as much as possible and use relative URLs whenever it can to make sure your site works no matter _where_ you end up actually deploying it.
|
- Note that Quartz 4 will avoid using this as much as possible and use relative URLs whenever it can to make sure your site works no matter _where_ you end up actually deploying it.
|
||||||
- `ignorePatterns`: a list of [glob](<https://en.wikipedia.org/wiki/Glob_(programming)>) patterns that Quartz should ignore and not search through when looking for files inside the `content` folder. See [[private pages]] for more details.
|
- `ignorePatterns`: a list of [glob](<https://en.wikipedia.org/wiki/Glob_(programming)>) patterns that Quartz should ignore and not search through when looking for files inside the `content` folder. See [[private pages]] for more details.
|
||||||
- `lowercasePaths`: whether to convert all generated paths (URLs) to lowercase. When set to `true`, a file named `MyFile.md` will be available at `/myfile` instead of `/MyFile`. This also applies to tags but not aliases. Default is `false`.
|
- `lowercasePaths`: whether to convert all generated paths (URLs) to lowercase. When set to `true`, a file named `MyFile.md` will be available at `/myfile` instead of `/MyFile`. This also applies to tags but not aliases.
|
||||||
- `defaultDateType`: whether to use created, modified, or published as the default date to display on pages and page listings.
|
- `defaultDateType`: whether to use created, modified, or published as the default date to display on pages and page listings.
|
||||||
- `theme`: configure how the site looks.
|
- `theme`: configure how the site looks.
|
||||||
- `cdnCaching`: if `true` (default), use Google CDN to cache the fonts. This will generally be faster. Disable (`false`) this if you want Quartz to download the fonts to be self-contained.
|
- `cdnCaching`: if `true` (default), use Google CDN to cache the fonts. This will generally be faster. Disable (`false`) this if you want Quartz to download the fonts to be self-contained.
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export interface GlobalConfiguration {
|
|||||||
/** Glob patterns to not search */
|
/** Glob patterns to not search */
|
||||||
ignorePatterns: string[]
|
ignorePatterns: string[]
|
||||||
/** Whether to convert all generated paths to lowercase (default: false) */
|
/** Whether to convert all generated paths to lowercase (default: false) */
|
||||||
lowercasePaths?: boolean
|
lowercasePaths: boolean
|
||||||
/** Whether to use created, modified, or published as the default type of date */
|
/** Whether to use created, modified, or published as the default type of date */
|
||||||
defaultDateType: ValidDateType
|
defaultDateType: ValidDateType
|
||||||
/** Base URL to use for CNAME files, sitemaps, and RSS feeds that require an absolute URL.
|
/** Base URL to use for CNAME files, sitemaps, and RSS feeds that require an absolute URL.
|
||||||
|
|||||||
@ -11,10 +11,10 @@ const filesToCopy = async (argv: Argv, cfg: QuartzConfig) => {
|
|||||||
return await glob("**", argv.directory, ["**/*.md", ...cfg.configuration.ignorePatterns])
|
return await glob("**", argv.directory, ["**/*.md", ...cfg.configuration.ignorePatterns])
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyFile = async (argv: Argv, fp: FilePath, cfg: QuartzConfig) => {
|
const copyFile = async (argv: Argv, fp: FilePath, lowercasePaths: boolean) => {
|
||||||
const src = joinSegments(argv.directory, fp) as FilePath
|
const src = joinSegments(argv.directory, fp) as FilePath
|
||||||
|
|
||||||
const name = slugifyFilePath(fp, undefined, cfg.configuration.lowercasePaths)
|
const name = slugifyFilePath(fp, undefined, lowercasePaths)
|
||||||
const dest = joinSegments(argv.output, name) as FilePath
|
const dest = joinSegments(argv.output, name) as FilePath
|
||||||
|
|
||||||
// ensure dir exists
|
// ensure dir exists
|
||||||
@ -31,7 +31,7 @@ export const Assets: QuartzEmitterPlugin = () => {
|
|||||||
async *emit({ argv, cfg }) {
|
async *emit({ argv, cfg }) {
|
||||||
const fps = await filesToCopy(argv, cfg)
|
const fps = await filesToCopy(argv, cfg)
|
||||||
for (const fp of fps) {
|
for (const fp of fps) {
|
||||||
yield copyFile(argv, fp, cfg)
|
yield copyFile(argv, fp, cfg.configuration.lowercasePaths)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async *partialEmit(ctx, _content, _resources, changeEvents) {
|
async *partialEmit(ctx, _content, _resources, changeEvents) {
|
||||||
@ -40,7 +40,7 @@ export const Assets: QuartzEmitterPlugin = () => {
|
|||||||
if (ext === ".md") continue
|
if (ext === ".md") continue
|
||||||
|
|
||||||
if (changeEvent.type === "add" || changeEvent.type === "change") {
|
if (changeEvent.type === "add" || changeEvent.type === "change") {
|
||||||
yield copyFile(ctx.argv, changeEvent.path, ctx.cfg)
|
yield copyFile(ctx.argv, changeEvent.path, ctx.cfg.configuration.lowercasePaths)
|
||||||
} else if (changeEvent.type === "delete") {
|
} else if (changeEvent.type === "delete") {
|
||||||
const name = slugifyFilePath(
|
const name = slugifyFilePath(
|
||||||
changeEvent.path,
|
changeEvent.path,
|
||||||
|
|||||||
@ -189,7 +189,7 @@ describe("transforms", () => {
|
|||||||
["Tags/", "./tags/"],
|
["Tags/", "./tags/"],
|
||||||
["/Tags/", "./tags/"],
|
["/Tags/", "./tags/"],
|
||||||
["Content/With Spaces", "./content/with-spaces"],
|
["Content/With Spaces", "./content/with-spaces"],
|
||||||
["Content/With Spaces/Index", "./content/with-spaces/"],
|
["Content/With Spaces/index", "./content/with-spaces/"],
|
||||||
["Content/With Spaces#And Anchor!", "./content/with-spaces#and-anchor"],
|
["Content/With Spaces#And Anchor!", "./content/with-spaces#and-anchor"],
|
||||||
["MixedCase/File.md", "./mixedcase/file"],
|
["MixedCase/File.md", "./mixedcase/file"],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -97,16 +97,7 @@ export function simplifySlug(fp: FullSlug): SimpleSlug {
|
|||||||
export function transformInternalLink(link: string, lowercase?: boolean): RelativeURL {
|
export function transformInternalLink(link: string, lowercase?: boolean): RelativeURL {
|
||||||
let [fplike, anchor] = splitAnchor(decodeURI(link))
|
let [fplike, anchor] = splitAnchor(decodeURI(link))
|
||||||
|
|
||||||
// If lowercase is enabled, check for folder path in a case-insensitive way
|
const folderPath = isFolderPath(fplike)
|
||||||
const folderPath = lowercase
|
|
||||||
? fplike.endsWith("/") ||
|
|
||||||
fplike.toLowerCase().endsWith("/index") ||
|
|
||||||
fplike.toLowerCase().endsWith("/index.md") ||
|
|
||||||
fplike.toLowerCase().endsWith("/index.html") ||
|
|
||||||
fplike.toLowerCase() === "index" ||
|
|
||||||
fplike.toLowerCase() === "index.md" ||
|
|
||||||
fplike.toLowerCase() === "index.html"
|
|
||||||
: isFolderPath(fplike)
|
|
||||||
let segments = fplike.split("/").filter((x) => x.length > 0)
|
let segments = fplike.split("/").filter((x) => x.length > 0)
|
||||||
let prefix = segments.filter(isRelativeSegment).join("/")
|
let prefix = segments.filter(isRelativeSegment).join("/")
|
||||||
let fp = segments.filter((seg) => !isRelativeSegment(seg) && seg !== "").join("/")
|
let fp = segments.filter((seg) => !isRelativeSegment(seg) && seg !== "").join("/")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user