File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ # Get the current date
2+ $currentDate = Get-Date
3+ $year = $currentDate.Year
4+ $month = $currentDate.Month.ToString (" D2" )
5+ $day = $currentDate.Day.ToString (" D2" )
6+
7+ # Define the folder path
8+ $folderPath = " docs/posts/$year /$month /$day "
9+
10+ # Create the folder if it doesn't exist
11+ if (-Not (Test-Path - Path $folderPath )) {
12+ New-Item - ItemType Directory - Path $folderPath - Force | Out-Null
13+ }
14+
15+ # Define the file path
16+ $filePath = " $folderPath /index.md"
17+
18+ # Create the markdown file with YAML front matter
19+ $title = " Your Blog Post Title"
20+ $date = $currentDate.ToString (" yyyy-MM-dd" )
21+
22+ $yamlContent = @"
23+ ---
24+ title: "$title "
25+ date: "$date "
26+ authors:
27+ -
28+ ---
29+ "@
30+
31+ # Write the content to the file
32+ Set-Content - Path $filePath - Value $yamlContent
33+
34+ Write-Output " Blog post template created at $filePath "
You can’t perform that action at this time.
0 commit comments