-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previous matching was generating wrong blog structure (paths were split on arbitrary `-`), which led to "dead link" complaints. Also the `.split` of the path was wrong because preceding slash is not part of the file, but maybe that's incosistent between mac & linux so I replaced it with a definitely crossplatform call
- Loading branch information
1 parent
e5101d4
commit c2fbea1
Showing
4 changed files
with
33 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
import fs from 'node:fs' | ||
import { parse } from 'yaml' | ||
import path from "node:path" | ||
import { parse } from "yaml" | ||
|
||
export default { | ||
watch: ['../about/jobs/*.md'], | ||
watch: ["../about/jobs/*.md"], | ||
|
||
load (files) { | ||
return files.map((file) => { | ||
const slug = file.split('/about/jobs/')[1].split('.')[0] | ||
load(files) { | ||
return files | ||
.map((file) => { | ||
const slug = path.basename(file, ".md") | ||
|
||
const contents = fs.readFileSync(file, 'utf-8') | ||
const frontmatter = contents.split('---\n')[1] | ||
const contents = fs.readFileSync(file, "utf-8") | ||
const frontmatter = contents.split("---\n")[1] | ||
|
||
const data = parse(frontmatter) | ||
data.link = `/about/jobs/${slug}` | ||
const data = parse(frontmatter) | ||
data.link = `/about/jobs/${slug}` | ||
|
||
return data | ||
}).filter(x => x.active) | ||
} | ||
return data | ||
}) | ||
.filter((x) => x.active) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
import fs from 'node:fs' | ||
import { parse } from 'yaml' | ||
import path from "node:path" | ||
import { parse } from "yaml" | ||
|
||
export default { | ||
watch: ['../use-cases/*.md'], | ||
watch: ["../use-cases/*.md"], | ||
|
||
load (files) { | ||
return files.map((file) => { | ||
const slug = file.split('/use-cases/')[1].split('.')[0] | ||
load(files) { | ||
return files | ||
.map((file) => { | ||
const slug = path.basename(file, ".md") | ||
|
||
const contents = fs.readFileSync(file, 'utf-8') | ||
const frontmatter = contents.split('---\n')[1] | ||
const contents = fs.readFileSync(file, "utf-8") | ||
const frontmatter = contents.split("---\n")[1] | ||
|
||
const data = parse(frontmatter) | ||
data.link = `/use-cases/${slug}` | ||
const data = parse(frontmatter) | ||
data.link = `/use-cases/${slug}` | ||
|
||
return data | ||
}).filter(x => x.homepage) | ||
return data | ||
}) | ||
.filter((x) => x.homepage) | ||
.sort((a, b) => { | ||
return parseInt(a.homepage_order) - parseInt(b.homepage_order) | ||
}) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters