docs: [Zurück zur Übersicht](../README.md) in Alle in README für jeder Verzeichnis
This commit is contained in:
27
add-footer.ps1
Normal file
27
add-footer.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
# Pfad zum docs-Ordner anpassen
|
||||
$root = "C:\Users\isa.LTW\Desktop\24.06.2025\NodeMap\24.06.2025 NodeMap\docs"
|
||||
|
||||
# Alle .md-Dateien rekursiv holen, außer README.md
|
||||
$mdFiles = Get-ChildItem -Path $root -Recurse -Filter *.md | Where-Object { $_.Name -ne "README.md" }
|
||||
|
||||
foreach ($file in $mdFiles) {
|
||||
$content = Get-Content $file.FullName -Raw
|
||||
|
||||
if ($content -notmatch "\[Zurück zur Übersicht\]") {
|
||||
# Pfad relativ zum Root-Ordner
|
||||
$relativePath = $file.DirectoryName.Substring($root.Length).TrimStart('\')
|
||||
$depth = if ($relativePath) { $relativePath.Split('\').Count } else { 0 }
|
||||
|
||||
# Rücksprungpfad berechnen
|
||||
$backPath = ("../" * $depth) + "README.md"
|
||||
|
||||
# Footer-Text (ohne Emojis!)
|
||||
$footer = "`n---`n`n[Zurück zur Übersicht]($backPath)`n`n"
|
||||
|
||||
# Footer anhängen
|
||||
Add-Content -Path $file.FullName -Value $footer
|
||||
Write-Host "✅ Footer hinzugefügt: $($file.FullName)"
|
||||
} else {
|
||||
Write-Host "🔄 Footer bereits vorhanden: $($file.FullName)"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user