Skip to content

Commit 6109984

Browse files
committed
add robots.txt to wordpress
1 parent a90a4ab commit 6109984

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

wordpress/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ copy_custom_files() {
2121
chown -R www-data:www-data /var/www/html/wp-content/themes/nextjs-headless
2222
fi
2323

24+
# Create robots.txt to block all crawlers (Next.js is the public site)
25+
echo "Creating robots.txt..."
26+
cat > /var/www/html/robots.txt << 'EOF'
27+
User-agent: *
28+
Disallow: /
29+
EOF
30+
chown www-data:www-data /var/www/html/robots.txt
31+
2432
# Run the setup script
2533
/usr/local/bin/setup-wordpress.sh
2634
}

wordpress/setup.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ if ! wp plugin is-active next-revalidate --allow-root 2>/dev/null; then
3434
wp plugin activate next-revalidate --allow-root
3535
fi
3636

37-
# Activate the headless theme
38-
current_theme=$(wp theme list --status=active --field=name --allow-root 2>/dev/null)
39-
if [ "$current_theme" != "nextjs-headless" ]; then
40-
echo "Activating Next.js Headless theme..."
41-
wp theme activate nextjs-headless --allow-root
42-
fi
37+
# Activate the headless theme (always run, safe if already active)
38+
echo "Activating Next.js Headless theme..."
39+
wp theme activate nextjs-headless --allow-root || true
4340

4441
# Configure the plugin if NEXTJS_URL is set
4542
if [ -n "$NEXTJS_URL" ]; then

0 commit comments

Comments
 (0)