23 lines
545 B
Bash
23 lines
545 B
Bash
|
#!/bin/bash
|
||
|
set -e
|
||
|
|
||
|
CONTENT_DIR="../content"
|
||
|
|
||
|
find "$CONTENT_DIR" -type f \( -name 'index.md' -o -name '_index.md' \) | while read -r file; do
|
||
|
base="${file%.md}" # Remove .md
|
||
|
new_file="${base}.de.md" # Append .de.md
|
||
|
|
||
|
if [ ! -f "$new_file" ]; then
|
||
|
echo "Creating $new_file"
|
||
|
cp "$file" "$new_file"
|
||
|
|
||
|
# macOS-compatible sed (empty backup extension)
|
||
|
sed -i '' 's/^title = "\(.*\)"/title = "Übersetzung: \1"/' "$new_file"
|
||
|
else
|
||
|
echo "Skipping $new_file (already exists)"
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
echo "German stub creation complete."
|