feat: добавил категории (Kubernetes, Веб-разработка, DevOps практики, Homelab) + Страницу Об авторе
This commit is contained in:
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Скрипт добавляет categories в frontmatter статей
|
||||
|
||||
# Функция добавления категорий
|
||||
add_categories() {
|
||||
local file=$1
|
||||
local categories=$2
|
||||
|
||||
echo "Обрабатываю: $file"
|
||||
|
||||
# Проверяем есть ли уже categories
|
||||
if grep -q "^categories:" "$file"; then
|
||||
echo " → Уже есть categories, заменяю"
|
||||
# Удаляем старую строку categories
|
||||
sed -i '/^categories:/d' "$file"
|
||||
fi
|
||||
|
||||
# Вставляем categories после tags
|
||||
awk -v cats="$categories" '
|
||||
/^tags:/ {
|
||||
print
|
||||
getline
|
||||
while ($0 ~ /^ -/ || $0 ~ /^\[/) {
|
||||
print
|
||||
if (getline <= 0) break
|
||||
}
|
||||
print cats
|
||||
print
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
||||
|
||||
echo " ✓ Добавлены категории"
|
||||
}
|
||||
|
||||
# K3s статьи
|
||||
add_categories "content/posts/k3s-part1-architecture/index.md" 'categories: ["Kubernetes", "Homelab"]'
|
||||
add_categories "content/posts/k3s-part2-infrastructure/index.md" 'categories: ["Kubernetes", "Homelab"]'
|
||||
add_categories "content/posts/k3s-part3-installation/index.md" 'categories: ["Kubernetes", "Homelab", "DevOps практики"]'
|
||||
|
||||
# Blog статьи
|
||||
add_categories "content/posts/blog-part-1-architecture/index.md" 'categories: ["Веб-разработка"]'
|
||||
add_categories "content/posts/blog-part-2-k8s-deployment/index.md" 'categories: ["Kubernetes", "Веб-разработка"]'
|
||||
add_categories "content/posts/blog-part-3-dev-environment/index.md" 'categories: ["Веб-разработка", "DevOps практики"]'
|
||||
add_categories "content/posts/blog-part-4-git-workflow/index.md" 'categories: ["Веб-разработка", "DevOps практики"]'
|
||||
add_categories "content/posts/blog-part-5-debugging/index.md" 'categories: ["Kubernetes", "DevOps практики"]'
|
||||
add_categories "content/posts/blog-part-6-namespace-migration/index.md" 'categories: ["Kubernetes", "DevOps практики"]'
|
||||
|
||||
echo ""
|
||||
echo "Готово! Проверь изменения:"
|
||||
echo "git diff content/posts/"
|
||||
Reference in New Issue
Block a user