mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-25 21:16:21 +00:00
fix: slugify tag on page before adding (closes #411)
This commit is contained in:
parent
c91e62c376
commit
52ca312f41
1 changed files with 2 additions and 1 deletions
|
@ -383,13 +383,14 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
|
||||||
return (tree: Root, file) => {
|
return (tree: Root, file) => {
|
||||||
const base = pathToRoot(file.data.slug!)
|
const base = pathToRoot(file.data.slug!)
|
||||||
findAndReplace(tree, tagRegex, (_value: string, tag: string) => {
|
findAndReplace(tree, tagRegex, (_value: string, tag: string) => {
|
||||||
|
tag = slugTag(tag)
|
||||||
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
||||||
file.data.frontmatter.tags.push(tag)
|
file.data.frontmatter.tags.push(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: "link",
|
type: "link",
|
||||||
url: base + `/tags/${slugTag(tag)}`,
|
url: base + `/tags/${tag}`,
|
||||||
data: {
|
data: {
|
||||||
hProperties: {
|
hProperties: {
|
||||||
className: ["tag-link"],
|
className: ["tag-link"],
|
||||||
|
|
Loading…
Reference in a new issue