89 lines
3.7 KiB
Bash
89 lines
3.7 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
# Fix Spanish Content Slug Normalization
|
||
|
|
# This script fixes slug generation issues in Spanish content where accented characters weren't properly normalized
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
echo "🔧 Fixing Spanish content slug normalization..."
|
||
|
|
|
||
|
|
# Function to normalize Spanish slug
|
||
|
|
normalize_spanish_slug() {
|
||
|
|
echo "$1" | \
|
||
|
|
sed 's/á/a/g' | \
|
||
|
|
sed 's/é/e/g' | \
|
||
|
|
sed 's/í/i/g' | \
|
||
|
|
sed 's/ó/o/g' | \
|
||
|
|
sed 's/ú/u/g' | \
|
||
|
|
sed 's/ü/u/g' | \
|
||
|
|
sed 's/ñ/n/g' | \
|
||
|
|
sed 's/ç/c/g' | \
|
||
|
|
tr '[:upper:]' '[:lower:]' | \
|
||
|
|
sed 's/[[:space:]]\+/-/g' | \
|
||
|
|
sed 's/[^a-z0-9-]//g' | \
|
||
|
|
sed 's/--\+/-/g' | \
|
||
|
|
sed 's/^-\|-$//g'
|
||
|
|
}
|
||
|
|
|
||
|
|
# Fix specific problematic slugs in Spanish blog content
|
||
|
|
echo "Fixing Spanish blog content slugs..."
|
||
|
|
|
||
|
|
# Fix web3-development-with-rust.md
|
||
|
|
if [ -f "content/blog/es/web3-development-with-rust.md" ]; then
|
||
|
|
echo "Fixing web3-development-with-rust.md slug..."
|
||
|
|
sed -i '' 's/slug: "desarrollo-web3-con-rust-una-gu-a-pr-ctica"/slug: "desarrollo-web3-con-rust-una-guia-practica"/' content/blog/es/web3-development-with-rust.md
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Fix infrastructure-as-code-best-practices.md
|
||
|
|
if [ -f "content/blog/es/infrastructure-as-code-best-practices.md" ]; then
|
||
|
|
echo "Fixing infrastructure-as-code-best-practices.md slug..."
|
||
|
|
sed -i '' 's/slug: "infraestructura-como-c-digo-mejores-pr-cticas-para-2024"/slug: "infraestructura-como-codigo-mejores-practicas-para-2024"/' content/blog/es/infrastructure-as-code-best-practices.md
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Fix rust-microservices-patterns.md if it has issues
|
||
|
|
if [ -f "content/blog/es/rust-microservices-patterns.md" ]; then
|
||
|
|
echo "Checking rust-microservices-patterns.md..."
|
||
|
|
if grep -q "gu-a" content/blog/es/rust-microservices-patterns.md; then
|
||
|
|
echo "Fixing rust-microservices-patterns.md slug..."
|
||
|
|
sed -i '' 's/gu-a/guia/g' content/blog/es/rust-microservices-patterns.md
|
||
|
|
sed -i '' 's/pr-ctica/practica/g' content/blog/es/rust-microservices-patterns.md
|
||
|
|
sed -i '' 's/c-digo/codigo/g' content/blog/es/rust-microservices-patterns.md
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Fix rust-web-development-2024.md if it has issues
|
||
|
|
if [ -f "content/blog/es/rust-web-development-2024.md" ]; then
|
||
|
|
echo "Checking rust-web-development-2024.md..."
|
||
|
|
if grep -q "gu-a\|pr-ctica\|c-digo" content/blog/es/rust-web-development-2024.md; then
|
||
|
|
echo "Fixing rust-web-development-2024.md slug..."
|
||
|
|
sed -i '' 's/gu-a/guia/g' content/blog/es/rust-web-development-2024.md
|
||
|
|
sed -i '' 's/pr-ctica/practica/g' content/blog/es/rust-web-development-2024.md
|
||
|
|
sed -i '' 's/c-digo/codigo/g' content/blog/es/rust-web-development-2024.md
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Fix self-hosted-ci-cd-rust-kubernetes.md if it has issues
|
||
|
|
if [ -f "content/blog/es/self-hosted-ci-cd-rust-kubernetes.md" ]; then
|
||
|
|
echo "Checking self-hosted-ci-cd-rust-kubernetes.md..."
|
||
|
|
if grep -q "integración\|continúa" content/blog/es/self-hosted-ci-cd-rust-kubernetes.md; then
|
||
|
|
echo "Fixing self-hosted-ci-cd-rust-kubernetes.md slug..."
|
||
|
|
sed -i '' 's/integración/integracion/g' content/blog/es/self-hosted-ci-cd-rust-kubernetes.md
|
||
|
|
sed -i '' 's/continúa/continua/g' content/blog/es/self-hosted-ci-cd-rust-kubernetes.md
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "✅ Spanish blog content slug fixes completed"
|
||
|
|
|
||
|
|
# Fix Spanish page content if any exist
|
||
|
|
echo "Checking Spanish page content..."
|
||
|
|
|
||
|
|
# Check if privacy page needs fixes
|
||
|
|
if [ -f "content/pages/es/privacy.md" ] && ! grep -q "slug:" content/pages/es/privacy.md; then
|
||
|
|
echo "Adding slug to Spanish privacy page..."
|
||
|
|
# Add slug after title line
|
||
|
|
sed -i '' '1a\
|
||
|
|
slug: "politica-de-privacidad"' content/pages/es/privacy.md
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "✅ All Spanish content slug normalization fixes completed"
|
||
|
|
echo "🎉 Spanish slug normalization complete!"
|