Files
dealplustech-astroreal/scripts/build_og_image.py
hermes b34f8fc2fb feat(blog): Phase 5 SEO/GEO content with 5 new blog posts
Add 5 long-form Thai blog posts (1,200-2,500 words each) with SEO + GEO
optimization for the dealplustech water-systems site. Each post targets
a specific audience (contractors, engineers, project managers) and
follows a content-quality workflow: source real product specs, verify
Thai text, dedupe images, link back to product pages.

## New blog posts (src/content/blog/)
- thermobreak-guide.md (Thermobreak closed-cell insulation overview)
- plastic-grilles-guide.md (ABS plastic grilles for HVAC)
- ppr-pipe-guide.md (PPR pipe properties + heat-fusion welding)
- ppr-vs-hdpe-vs-upvc.md (3-way pipe comparison with PE80/PE100)
- thermobreak-series-guide.md (Thermobreak LS vs Solar series)
- 10-things-checklist-pipe-ordering.md (10-point pre-order checklist)

## Removed legacy posts
- pipe-knowledge.md, valve-guide.md, welcome-post.md (orphans)

## Hero images (public/images/blog/)
~20 product photos sourced from manufacturers (Thermobreak, Thai PPR,
thaiconsupply) plus Nano Banana Pro infographics. All resized to
3:2 aspect ratio per user preference. Source folder preserved for
re-derivation.

## Astro layout/SEO work
- src/components/seo/SEO.astro, JsonLd.astro (new SEO components)
- src/layouts/BaseLayout.astro, Layout.astro (OG/Twitter/JSON-LD wiring)
- src/pages/404.astro
- Product pages (8): added #pricelist anchors + schema work
- src/styles/global.css: scroll-padding for sticky-header anchors

## Automation scripts (scripts/)
- build_og_image.py (OG image builder)
- inject_faq_schema.py, inject_product_schema.py (JSON-LD injection)

## Misc
- public/robots.txt, public/images/og/default-og.jpg
- .gitignore: exclude scripts/__pycache__/
2026-06-08 12:45:32 +07:00

41 lines
1.2 KiB
Python

"""Generate a clean OG image (1200x630, white background, centered logo)."""
from PIL import Image
import os
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LOGO = os.path.join(ROOT, "public/images/logo/dealplustech-logo.png")
OUT = os.path.join(ROOT, "public/images/og/default-og.jpg")
CANVAS_W, CANVAS_H = 1200, 630
LOGO_MAX_W = int(CANVAS_W * 0.70) # 70% of canvas width
LOGO_MAX_H = int(CANVAS_H * 0.70) # 70% of canvas height
# 1. White canvas
canvas = Image.new("RGB", (CANVAS_W, CANVAS_H), (255, 255, 255))
# 2. Open logo (RGBA)
logo = Image.open(LOGO).convert("RGBA")
lw, lh = logo.size
print(f"logo original: {lw}x{lh}")
# 3. Scale logo to fit within 70% box, preserve aspect ratio
scale = min(LOGO_MAX_W / lw, LOGO_MAX_H / lh)
new_w = int(lw * scale)
new_h = int(lh * scale)
logo = logo.resize((new_w, new_h), Image.LANCZOS)
print(f"logo scaled: {new_w}x{new_h}")
# 4. Center
x0 = (CANVAS_W - new_w) // 2
y0 = (CANVAS_H - new_h) // 2
# 5. Paste (uses alpha as mask)
canvas.paste(logo, (x0, y0), logo)
# 6. Save as JPEG quality 90
os.makedirs(os.path.dirname(OUT), exist_ok=True)
canvas.save(OUT, "JPEG", quality=90, optimize=True, progressive=True)
size = os.path.getsize(OUT)
print(f"wrote: {OUT} ({size:,} bytes)")