128 lines
5.1 KiB
Bash
128 lines
5.1 KiB
Bash
#!/bin/bash
|
|
# Bootstrap English WordPress for AdSense review (idempotent-ish).
|
|
set -euo pipefail
|
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
cd "$DIR"
|
|
|
|
if [[ ! -f .env ]]; then
|
|
echo "Missing .env — copy from .env.example and set passwords"
|
|
exit 1
|
|
fi
|
|
# shellcheck disable=SC1091
|
|
source .env
|
|
|
|
WP() {
|
|
docker compose --profile tools run --rm wpcli "$@"
|
|
}
|
|
|
|
echo "==> Waiting for WordPress HTTP..."
|
|
for i in $(seq 1 60); do
|
|
if curl -fsS "http://127.0.0.1:8088" >/dev/null 2>&1; then
|
|
break
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
if ! WP core is-installed >/dev/null 2>&1; then
|
|
echo "==> Installing WordPress (English)"
|
|
WP core install \
|
|
--url="https://nomadro.com" \
|
|
--title="Nomadro" \
|
|
--admin_user="${WP_ADMIN_USER}" \
|
|
--admin_password="${WP_ADMIN_PASSWORD}" \
|
|
--admin_email="${WP_ADMIN_EMAIL}" \
|
|
--skip-email
|
|
fi
|
|
|
|
echo "==> Core settings"
|
|
WP language core install en_US --activate || true
|
|
WP option update blogdescription "Digital nomad guides for remote work, travel, and location-independent income"
|
|
WP option update WPLANG ""
|
|
WP option update blog_public 1
|
|
WP option update timezone_string "UTC"
|
|
WP option update date_format "F j, Y"
|
|
WP option update time_format "g:i a"
|
|
WP option update start_of_week 1
|
|
WP option update show_on_front posts
|
|
WP rewrite structure '/%postname%/' --hard
|
|
WP rewrite flush --hard
|
|
|
|
echo "==> Theme + essentials"
|
|
WP theme install twentytwentyfive --activate || WP theme activate twentytwentyfive || true
|
|
WP plugin install wordpress-seo --activate || true
|
|
WP option patch update wpseo_titles noindex-author-wpseo true || true
|
|
|
|
# Remove Hello World / Sample Page if present
|
|
HELLO_ID=$(WP post list --post_type=post --name=hello-world --field=ID 2>/dev/null || true)
|
|
if [[ -n "${HELLO_ID}" ]]; then
|
|
WP post delete "${HELLO_ID}" --force || true
|
|
fi
|
|
SAMPLE_ID=$(WP post list --post_type=page --name=sample-page --field=ID 2>/dev/null || true)
|
|
if [[ -n "${SAMPLE_ID}" ]]; then
|
|
WP post delete "${SAMPLE_ID}" --force || true
|
|
fi
|
|
|
|
create_page() {
|
|
local slug="$1"
|
|
local title="$2"
|
|
local file="$3"
|
|
local existing
|
|
existing=$(WP post list --post_type=page --name="$slug" --field=ID 2>/dev/null || true)
|
|
if [[ -n "$existing" ]]; then
|
|
echo "Page exists: $slug ($existing)"
|
|
return
|
|
fi
|
|
WP post create "$file" --post_type=page --post_title="$title" --post_name="$slug" --post_status=publish
|
|
}
|
|
|
|
create_post() {
|
|
local slug="$1"
|
|
local title="$2"
|
|
local file="$3"
|
|
local existing
|
|
existing=$(WP post list --post_type=post --name="$slug" --field=ID 2>/dev/null || true)
|
|
if [[ -n "$existing" ]]; then
|
|
echo "Post exists: $slug ($existing)"
|
|
return
|
|
fi
|
|
WP post create "$file" --post_type=post --post_title="$title" --post_name="$slug" --post_status=publish
|
|
}
|
|
|
|
echo "==> Policy / trust pages"
|
|
create_page about "About Nomadro" /content/about.html
|
|
create_page contact "Contact" /content/contact.html
|
|
create_page privacy-policy "Privacy Policy" /content/privacy-policy.html
|
|
create_page terms "Terms of Service" /content/terms.html
|
|
|
|
echo "==> English articles"
|
|
create_post what-is-a-digital-nomad "What Is a Digital Nomad? A Practical Definition" /content/posts/01-what-is-a-digital-nomad.html
|
|
create_post how-to-start-remote-work "How to Start Remote Work Without Quitting Overnight" /content/posts/02-start-remote-work.html
|
|
create_post geo-arbitrage-basics "Geo-Arbitrage Basics: Lower Costs Without Lowering Ambition" /content/posts/03-geo-arbitrage.html
|
|
create_post packing-list-long-stay "A Practical Packing List for Long-Stay Travel" /content/posts/04-packing-list.html
|
|
create_post coworking-vs-home "Coworking vs Home Office Abroad: How to Choose" /content/posts/05-coworking-vs-home.html
|
|
create_post internet-checklist "Internet Reliability Checklist for Remote Workers" /content/posts/06-internet-checklist.html
|
|
create_post time-zone-collaboration "Working Across Time Zones Without Burning Out" /content/posts/07-time-zones.html
|
|
create_post building-online-income "Building Online Income Streams as a Nomad" /content/posts/08-online-income.html
|
|
create_post city-research-framework "A Simple Framework for Researching Your Next City" /content/posts/09-city-research.html
|
|
create_post live-streaming-toolkit "Live Streaming Toolkit Basics for Creators on the Move" /content/posts/10-live-streaming.html
|
|
create_post banking-and-payments "Banking and Payments Tips for Location-Independent Work" /content/posts/11-banking-payments.html
|
|
create_post routines-that-travel "Routines That Travel: Habits That Survive New Cities" /content/posts/12-routines.html
|
|
|
|
# Footer menu with trust pages
|
|
MENU_ID=$(WP menu list --fields=term_id,name --format=csv 2>/dev/null | awk -F, '$2=="Footer"{print $1; exit}' || true)
|
|
if [[ -z "${MENU_ID}" ]]; then
|
|
MENU_ID=$(WP menu create "Footer" --porcelain)
|
|
fi
|
|
# Avoid duplicate items by recreating links carefully
|
|
for slug in about contact privacy-policy terms; do
|
|
PAGE_ID=$(WP post list --post_type=page --name="$slug" --field=ID)
|
|
if [[ -n "$PAGE_ID" ]]; then
|
|
WP menu item add-post "$MENU_ID" "$PAGE_ID" || true
|
|
fi
|
|
done
|
|
WP menu location assign "$MENU_ID" footer || true
|
|
WP menu location assign "$MENU_ID" primary || true
|
|
|
|
echo "==> Done. Admin: https://nomadro.com/wp-admin/"
|