Skip to content

Conversation

@rodrigooler
Copy link
Collaborator

Summary

  • Migrate blog content management from markdown files to Sanity CMS
  • Switch deployment adapter from Node.js to Vercel
  • Update all dependencies to latest stable versions
  • Implement Sanity Studio at /studio path
  • Add comprehensive documentation for CMS usage and deployment

Key Changes

Content Management:

  • Sanity CMS integration with GROQ queries
  • Portable Text content rendering with HTML sanitization
  • Asset management and image optimization via Sanity CDN
  • Migration script to import markdown posts into Sanity

Infrastructure:

  • Vercel adapter for optimized deployment
  • Environment variable configuration for Sanity credentials
  • Docker multi-stage build with Sanity env support
  • GitHub Actions CI with Sanity secrets

Dependencies:

  • Astro updated to 5.16.0
  • React & related packages updated to 19.x
  • Sanity packages integrated (@sanity/client, @sanity/astro, etc.)
  • Added dotenv for build-time configuration

Documentation:

  • CMS usage guide (docs/CMS.md)
  • Deployment guide (docs/DEPLOYMENT.md)
  • README updated with Sanity integration info
  • Project rules in .cursorrules

Test Plan

  • Verify Sanity CMS configuration with environment variables
  • Check bundle optimization and chunk splitting
  • Confirm Docker build with Sanity credentials
  • Review CI workflow with necessary secrets
  • Validate git history (co-authors removed)

the-seeker0 and others added 30 commits October 27, 2025 15:38
- add .cursorrules with coding standards and guidelines
- configure eslint exception for env.d.ts
- enforce english-only code policy
- add sanity cms integration with studio at /admin route
- create centralized config in src/lib/sanity.config.ts
- add sanity client and api queries
- create blogPost schema matching markdown structure
- implement environment variable management
- add sanity dependencies and types
- create getAllPosts utility to combine markdown and sanity posts
- update all pages to use unified post collection
- add sanity post detection and rendering in PostDetails
- convert portable text to html for sanity posts
- maintain consistent post structure across sources
- add detailed step-by-step guide for creating posts
- document all post fields with descriptions
- include troubleshooting section
- add best practices and tips
- add 17 useful commands for development workflow
- include composite workflows (start, check, fix, prod)
- provide shorter alternatives to pnpm commands
- add cleanup and maintenance commands
- add content management section
- document justfile commands
- link to cms documentation
- update command reference
- add detailed conventional commit guidelines
- define commit types and rules
- add examples of good and bad commits
- specify no claude signatures policy
- update env var naming convention in cursorrules
- rename all sanity env vars with TORUS_BLOG_ prefix
- update .env.example with new variable names
- update sanity.config.ts to use prefixed variables
- remove path reference to .astro/types.d.ts (auto-imported)
- keep only types references which are valid
- remove eslint triple-slash-reference exception
- resolve linting issue properly instead of disabling rule
- add build args to dockerfile for sanity env vars
- configure github actions ci with environment secrets
- create comprehensive deployment guide
- document setup for docker, vercel, netlify, cloudflare, railway
- add troubleshooting section for common deployment issues
- replace deprecated deskTool with structureTool in sanity config
- add proper type for vite plugins in astro config
- fix content component type in postdetails layout
- remove unused ts-expect-error directive
- ensure htmlcontent handles undefined with fallback
rodrigooler and others added 19 commits December 3, 2025 16:35
…ginx

- Replace Nginx static file serving with Node.js server runtime
- Switch Docker runtime base image from nginx:mainline-alpine-slim to node:lts-alpine
- Update Dockerfile to copy dist and node_modules, expose port 3000, and run entry.mjs
- Add Astro server configuration to bind to 0.0.0.0:4321 for Docker port exposure
- Tested and verified application responds correctly on http://localhost:3000
Update dependencies to use @astrojs/vercel for Vercel deployments instead of @astrojs/node.
Remove unused hideEditPost prop that was referencing a deleted schema field.
Ensure only published posts (draft != true) are returned from Sanity in production.
This prevents draft posts from appearing on the public site.
Use the 'published' perspective when creating the Sanity client to automatically
exclude draft documents. This is the recommended approach according to Sanity's
documentation and handles drafts at the API level rather than in queries.
…ion script

- Convert markdown parsing pipeline to async to support inline image uploads
- Update SanityImageBlock interface to use asset references instead of URLs
- Make createImageBlock, processImage, processLine, parseMarkdownRecursive, and markdownToPortableText async
- Pass SanityClient through parsing functions to enable image uploads
- Add createImageBlock async function that uploads images and returns asset references
- Handle missing/failed images gracefully with text placeholders
- Enhance logging with upload progress indicators (📤 📊 ✅)
- Add deleteAllPosts function to bulk delete posts from Sanity
- Add delete-all command handler with batch processing (size: 10)
- Update usage documentation with delete-all command

This fixes the bug where inline images in markdown content were stored as local paths
instead of Sanity asset references. Now images are properly uploaded during migration.
- Update SanityImageBlock to support both asset references and direct URLs
- Add buildImageUrl function to construct public Sanity CDN URLs
- Change uploadImageAsset to return public CDN URL instead of asset reference
- Update createImageBlock to use url field with public CDN link
- Enhance logging to display full CDN URL after upload

This approach allows images to be displayed immediately using public CDN URLs
instead of requiring asset reference resolution. The URL format matches:
https://cdn.sanity.io/images/{projectId}/{dataset}/{assetId}
- Update SanityImageBlock to require asset reference structure
- Change uploadImageAsset to return assetId instead of URL
- Update createImageBlock to create asset references (image-assetId)
- Convert ogImage handling to use asset references
- Remove unused buildImageUrl function

The correct Sanity structure uses asset references:
{ _type: 'image', asset: { _type: 'reference', _ref: 'image-assetId' } }

Instead of direct URLs. This allows Sanity to properly track and manage
image assets, making them visible in the Studio UI and enabling features
like alt text, captions, and hotspot editing.
- Remove markdown post collection loading from getAllPosts()
- Remove getCollection import and usage (no longer needed)
- Remove markdown rendering logic from PostDetails.astro
- Remove render import from PostDetails.astro
- Simplify post content rendering to only use Sanity HTML
- Remove getPath import (not needed for Sanity-only posts)
- Disable dynamic OG image generation for Sanity posts

All blog posts are now exclusively sourced from Sanity CMS.
Markdown files in src/data/blog/ are no longer loaded or processed.
The scripts/migrate.ts file imports dotenv but it was not declared as a dependency, causing the build to fail during astro check. Added dotenv as a dev dependency to resolve the TypeScript error.
@vercel
Copy link

vercel bot commented Jan 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
torus-blog Ready Ready Preview, Comment Jan 12, 2026 7:50pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Main branch removed markdown posts in favor of Sanity CMS-only content.
Deleted conflicting understanding-torus.md and associated images.
All blog content should now be managed exclusively through Sanity CMS.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 12, 2026

Deploying torus-blog with  Cloudflare Pages  Cloudflare Pages

Latest commit: 20cca2c
Status: ✅  Deploy successful!
Preview URL: https://46fe54cb.torus-blog.pages.dev
Branch Preview URL: https://dev.torus-blog.pages.dev

View logs

- Remove unused 'publicUrl' variable assignment
- Remove unused 'i' parameter from forEach callback

This fixes ESLint errors preventing CI from passing.
@rodrigooler rodrigooler self-assigned this Jan 12, 2026
@rodrigooler rodrigooler requested a review from EdSDR January 12, 2026 19:46
@rodrigooler rodrigooler merged commit b92467c into main Jan 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants