Skip to content

About

πŸ—’οΈ An archive of my CriticalMAS blog

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

15 Commits

Folders and files

Repository files navigation

Critical MAS - WordPress to Astro Conversion

This project converts the Critical MAS WordPress blog into a static Astro website.

About Critical MAS

Critical MAS (Michael Allen Smith) is a long-running personal blog covering fitness, nutrition, coffee, and urban exploration, spanning over two decades (2005-2025).

The site features 1,700+ posts with extensive commenting history (preserved as static content), detailed photography, and practical experiments in health optimization. This archive preserves 20 years of writing, research, and community discussion in a fast, modern format.

Project Structure

export-cm-wordpress/
β”œβ”€β”€ PRD.md                          # Product Requirements Document
β”œβ”€β”€ conversion-script/              # Node.js conversion tool
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.js               # Main orchestrator
β”‚   β”‚   β”œβ”€β”€ parser.js              # WordPress XML parser
β”‚   β”‚   β”œβ”€β”€ converter.js           # HTML to Markdown
β”‚   β”‚   β”œβ”€β”€ comment-sanitizer.js   # Remove PII from comments
β”‚   β”‚   β”œβ”€β”€ image-processor.js     # Copy and organize images
β”‚   β”‚   β”œβ”€β”€ link-fixer.js          # Fix internal links
β”‚   β”‚   └── utils.js               # Helper functions
β”‚   β”œβ”€β”€ config.js                  # Configuration
β”‚   └── package.json
β”œβ”€β”€ astro-site/                     # Astro static site
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ content/
β”‚   β”‚   β”‚   β”œβ”€β”€ config.ts          # Content collections schema
β”‚   β”‚   β”‚   └── posts/             # Generated markdown posts
β”‚   β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   β”‚   └── BaseLayout.astro   # Base page layout
β”‚   β”‚   β”œβ”€β”€ components/            # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/                 # Site pages
β”‚   β”‚   └── styles/
β”‚   β”‚       └── global.css         # Global styles
β”‚   └── package.json
β”œβ”€β”€ criticalmas.WordPress.2025-11-10.xml  # WordPress export
└── uploads/                        # WordPress media files

Getting Started

Step 1: Run the Conversion Script

Convert WordPress XML to Markdown posts:

```bash cd conversion-script npm install npm run convert ```

For a dry run (preview only, no files written):

```bash npm run convert:dry-run ```

This will:

  • Parse the WordPress XML export
  • Convert HTML content to Markdown
  • Sanitize comments (remove email, IP addresses)
  • Copy referenced images to post folders
  • Generate posts in astro-site/src/content/posts/
  • Create metadata files in astro-site/src/data/

Step 2: Build & Run the Astro Site

```bash cd ../astro-site npm install npm run dev ```

Visit http://localhost:4321 to preview the site.

Step 3: Build for Production

```bash npm run build npm run preview ```

The built site will be in the dist/ folder.

Key Features

  • βœ… Preserved post URLs: /YYYY/MM/post-slug/
  • βœ… Sanitized comments appended to posts
  • βœ… Images copied to post folders
  • βœ… Internal links converted to relative paths
  • βœ… Categories and tags preserved
  • βœ… Clean, minimal design (no blue colors!)
  • βœ… Responsive layout
  • βœ… Archive by year, category, and tag

Configuration

Edit conversion-script/config.js to customize:

  • Input/output paths
  • Processing options
  • Link conversion rules
  • Logging verbosity

Deployment

The site can be deployed to any static hosting provider:

  • Netlify: Drag and drop the dist/ folder
  • Vercel: Connect your repo and deploy
  • GitHub Pages: Push dist/ to gh-pages branch
  • Traditional hosting: Upload dist/ contents via FTP

Notes

  • This is an archived blog - no CMS or editing capability
  • Comments are historical only (closed for new comments)
  • All PII removed from comments (email, IP, URLs)
  • Images only copied if referenced in posts
  • Conversion log saved to conversion-script/conversion-log.txt

Troubleshooting

Missing images: Check conversion-log.txt for details on which images couldn't be found.

Broken links: The conversion validates internal links. Check the log for any issues.

Build errors: Run npm run build in astro-site to see detailed error messages.

Support

Refer to the PRD.md for complete project documentation.

About

πŸ—’οΈ An archive of my CriticalMAS blog

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages