Rebuild as Astro static site (output identical to original)
- Move all 39 cloned pages + assets into public/ (Astro copies verbatim to dist/) -> dist/ is byte-identical to www.mitsuthailand.com (home 143633 bytes exact) - Add Astro project: astro.config.mjs, package.json, src/layouts/Base.astro, src/pages/example.astro (sample Astro component page, builds to /example/) - Multi-stage Dockerfile: pnpm build -> nginx serve + env-injecting entrypoint - Env-configurable: GA_ID, FORM_EMAIL, GMAP_LAT/LNG/.env.example - Remove Python crawl tooling and old nginx-static site/ layout - Verified: astro build -> 39 pages + example; all routes serve 200 via preview
This commit is contained in:
27
src/layouts/Base.astro
Normal file
27
src/layouts/Base.astro
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
// Base layout for pages built with Astro components.
|
||||
// NOTE: Mirrored content pages in public/ are served verbatim (identical to the
|
||||
// original Drupal output). This layout is used for pages we rebuild as Astro
|
||||
// components (e.g. the home page) so they stay editable while the rest of the
|
||||
// site remains an exact clone.
|
||||
interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
lang?: string;
|
||||
}
|
||||
|
||||
const { title = 'มิตซูชัยพร สมุทรสาคร', description = '', lang = 'th' } = Astro.props;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang={lang}>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description} />
|
||||
</head>
|
||||
<body>
|
||||
<slot />
|
||||
</body>
|
||||
</html>
|
||||
25
src/pages/example.astro
Normal file
25
src/pages/example.astro
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
// หน้า example — แสดงวิธีใช้ Astro component ใน project นี้
|
||||
//
|
||||
// โครงสร้าง site:
|
||||
// - เนื้อหาต้นฉบับ 39 หน้า อยู่ใน public/ (copy ตรง -> dist/) เหมือนต้นฉบับ 100%
|
||||
// - ถ้าอยาก "แก้" หน้าใดเป็น Astro component ให้ย้าย HTML นั้นออกจาก public/,
|
||||
// สร้าง src/pages/<route>.astro แล้วใช้ Base layout + components
|
||||
// - ตัวอย่างหน้า .astro ที่ build ได้ อยู่ด้านล่าง
|
||||
import Base from '../layouts/Base.astro';
|
||||
---
|
||||
|
||||
<Base title="ตัวอย่าง Astro Component — มิตซูชัยพร">
|
||||
<main style="font-family:sans-serif;max-width:800px;margin:2rem auto;padding:0 1rem">
|
||||
<h1>ตัวอย่างหน้า Astro</h1>
|
||||
<p>
|
||||
เว็บนี้เป็น Astro static site ที่ build ด้วย <code>pnpm build</code> →{" "}
|
||||
<code>dist/</code> หน้าต้นฉบับอยู่ใน <code>public/</code> (copy ตรง เหมือนเดิมเป๊ะ)
|
||||
</p>
|
||||
<p>
|
||||
หน้านี้ (<code>src/pages/example.astro</code>) เป็นตัวอย่างว่าเขียน component + layout
|
||||
แบบ Astro ได้ แล้ว build ออก static ได้เหมือนกัน
|
||||
</p>
|
||||
<a href="/" style="font-weight:bold">← กลับหน้าหลักมิตซูชัยพร</a>
|
||||
</main>
|
||||
</Base>
|
||||
Reference in New Issue
Block a user