wwwfiberdirekt/add-block-thumbnails.sh

54 lines
2.7 KiB
Bash

#!/bin/bash
# Run from your project root (wwwfiberdirekt)
B="src/blocks"
add_thumbnail() {
local file="$1"
local image="$2"
local alt="$3"
if [ ! -f "$file" ]; then
echo "⚠ MISSING: $file"
return
fi
# Skip if already added
if grep -q "imageURL" "$file"; then
echo "⏭ SKIPPED (already has imageURL): $file"
return
fi
sed -i '' "s|slug: '\([^']*\)',|slug: '\1',\n imageURL: '/block-thumbnails/${image}',\n imageAltText: '${alt}',|" "$file"
echo "$file"
}
# Blocks with thumbnails
add_thumbnail "$B/FDHeroBlock/config.ts" "fd-hero.png" "FD Hero"
add_thumbnail "$B/FDAlternateHeroBlock/config.ts" "fd-header-text-image-alt.png" "FD Alternativ Hero"
add_thumbnail "$B/FDHeaderTextImageBlock/config.ts" "fd-header-text-image.png" "FD Rubrik med bild"
add_thumbnail "$B/FDCardGridBlock/config.ts" "fd-card-grid.png" "FD Kortrutnät"
add_thumbnail "$B/FDWideCardBlock/config.ts" "fd-wide-card.png" "FD Bredt kort"
add_thumbnail "$B/FDPricingCardBlock/config.ts" "fd-pricing-card.png" "FD Priskort"
add_thumbnail "$B/FDUspTableBlock/config.ts" "fd-usp-table.png" "FD USP-tabell"
add_thumbnail "$B/FDUspChecklistBlock/config.ts" "fd-usp-checklist.png" "FD USP-checklista"
add_thumbnail "$B/FDServicesGridBlock/config.ts" "fd-services-grid.png" "FD Tjänsterrutnät"
add_thumbnail "$B/FDIconBarBlock/config.ts" "fd-icon-bar.png" "FD Ikonrad"
add_thumbnail "$B/FDFeatureAnnouncementBlock/config.ts" "fd-feature-announcement.png" "FD Funktionsnyhet"
add_thumbnail "$B/FDTechPropertiesBlock/config.ts" "fd-tech-properties.png" "FD Tekniska Egenskaper"
add_thumbnail "$B/FDCtaSideImageBlock/config.ts" "fd-cta-side-image.png" "FD CTA med bild"
add_thumbnail "$B/FDFaqBlock/config.ts" "fd-faq.png" "FD FAQ"
add_thumbnail "$B/FDContactBlock/config.ts" "fd-contact.png" "FD Kontaktformulär"
add_thumbnail "$B/FDContactFormBlock/config.ts" "fd-contact.png" "FD Kontaktformulär"
add_thumbnail "$B/FDSpacerBlock/config.ts" "fd-spacer.png" "FD Mellanrum"
add_thumbnail "$B/FDLocationsGridBlock/config.ts" "fd-places-grid.png" "FD Platser Grid"
echo ""
echo "Blocks without thumbnails yet (add images later):"
echo " FDCtaBannerBlock, FDCodeEmbedBlock, FDDataTableBlock"
echo " FDNewsletterBlock, FDPartnersLogosBlock, FDServiceChooserBlock"
echo " FDStatisticsBlock, FDTagsBlock, FDTeamBlock, FDTestimonialBlock"
echo " FDTextBlock, FDVideoBlock, FDVpsCalculatorBlock"
echo ""
echo "Done. Verify: grep -r 'imageURL' src/blocks/ | wc -l"