mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-06 09:16:29 +02:00
Add script to warmup URLs
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
"best-practice-dirs": "node scripts/best-practice-dirs.cjs",
|
"best-practice-dirs": "node scripts/best-practice-dirs.cjs",
|
||||||
"best-practice-content": "node scripts/best-practice-content.cjs",
|
"best-practice-content": "node scripts/best-practice-content.cjs",
|
||||||
"generate:og": "node ./scripts/generate-og-images.mjs",
|
"generate:og": "node ./scripts/generate-og-images.mjs",
|
||||||
"warm:og": "sh ./scripts/warm-og.sh https://roadmap.sh/sitemap-0.xml",
|
"warm:urls": "sh ./scripts/warm-urls.sh https://roadmap.sh/sitemap-0.xml",
|
||||||
"compress:images": "tsx ./scripts/compress-images.ts",
|
"compress:images": "tsx ./scripts/compress-images.ts",
|
||||||
"test:e2e": "playwright test"
|
"test:e2e": "playwright test"
|
||||||
},
|
},
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Usage: warm-og.sh <sitemap-url>
|
# Usage: warm-urls.sh <sitemap-url>
|
||||||
# Example: warm-og.sh https://www.example.com/sitemap.xml
|
# Example: warm-urls.sh https://www.example.com/sitemap.xml
|
||||||
|
|
||||||
# Check if sitemap url is provided
|
# Check if sitemap url is provided
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
@@ -19,9 +19,15 @@ for url in $urls; do
|
|||||||
# Fetch the og:image URL from the meta tags
|
# Fetch the og:image URL from the meta tags
|
||||||
og_image_url=$(curl -s "$url" | grep -o "<meta property=\"og:image\" content=\"[^\"]*\"" | sed 's#<meta property="og:image" content="\([^"]*\)"#\1#')
|
og_image_url=$(curl -s "$url" | grep -o "<meta property=\"og:image\" content=\"[^\"]*\"" | sed 's#<meta property="og:image" content="\([^"]*\)"#\1#')
|
||||||
|
|
||||||
|
# warm the URL
|
||||||
|
echo "Warming up URL: $url"
|
||||||
|
if ! curl -s -I "$url" > /dev/null; then
|
||||||
|
failed_urls+=("$url")
|
||||||
|
fi
|
||||||
|
|
||||||
# Warm up the og:image URL
|
# Warm up the og:image URL
|
||||||
if [ -n "$og_image_url" ]; then
|
if [ -n "$og_image_url" ]; then
|
||||||
echo "Warming up $og_image_url"
|
echo "Warming up OG: $og_image_url"
|
||||||
if ! curl -s -I "$og_image_url" > /dev/null; then
|
if ! curl -s -I "$og_image_url" > /dev/null; then
|
||||||
failed_urls+=("$og_image_url")
|
failed_urls+=("$og_image_url")
|
||||||
fi
|
fi
|
Reference in New Issue
Block a user