...
This commit is contained in:
+12
-1
@@ -16,7 +16,18 @@ Get-ChildItem -Path $src -Filter "*.md" | ForEach-Object {
|
||||
|
||||
Copy-Item $_.FullName (Join-Path $dst "$slug.md")
|
||||
|
||||
$entries += @{ slug = $slug; title = $base }
|
||||
$category = $null
|
||||
$content = Get-Content $_.FullName -Raw
|
||||
if ($content -match '(?s)^---\s*\n(.*?)\n---') {
|
||||
$frontmatter = $Matches[1]
|
||||
if ($frontmatter -match '(?m)^category:\s*(.+)$') {
|
||||
$category = $Matches[1].Trim().Trim('"')
|
||||
}
|
||||
}
|
||||
|
||||
$entry = @{ slug = $slug; title = $base }
|
||||
if ($category) { $entry.category = $category }
|
||||
$entries += $entry
|
||||
}
|
||||
|
||||
$indexPath = "$PSScriptRoot\wwwroot\docs\notes-index.json"
|
||||
|
||||
Reference in New Issue
Block a user