The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: reland string coercion in title

+8 -9
+8 -9
quartz/plugins/transformers/frontmatter.ts
··· 4 4 import yaml from "js-yaml" 5 5 import toml from "toml" 6 6 import { slugTag } from "../../util/path" 7 + import { QuartzPluginData } from "../vfile" 7 8 8 9 export interface Options { 9 10 delims: string | string[] ··· 37 38 }) 38 39 39 40 // tag is an alias for tags 40 - if (data.tag !== null) { 41 - data.tags = data.tag.toString() 41 + if (data.tag) { 42 + data.tags = data.tag 42 43 } 43 44 44 45 // coerce title to string 45 - if (data.title !== null) { 46 + if (data.title) { 46 47 data.title = data.title.toString() 48 + } else if (data.title === null || data.title === undefined) { 49 + data.title = file.stem ?? "Untitled" 47 50 } 48 51 49 - if (data.tags !== null && !Array.isArray(data.tags)) { 52 + if (data.tags && !Array.isArray(data.tags)) { 50 53 data.tags = data.tags 51 54 .toString() 52 55 .split(oneLineTagDelim) ··· 57 60 data.tags = [...new Set(data.tags?.map((tag: string) => slugTag(tag)))] ?? [] 58 61 59 62 // fill in frontmatter 60 - file.data.frontmatter = { 61 - title: file.stem ?? "Untitled", 62 - tags: [], 63 - ...data, 64 - } 63 + file.data.frontmatter = data as QuartzPluginData["frontmatter"] 65 64 } 66 65 }, 67 66 ]