Skip to content

Conversation

@vedantvaghasiya
Copy link
Contributor

@vedantvaghasiya vedantvaghasiya commented Jan 29, 2026

Issue: #3056

Description:

This PR migrates the Gumroad Blog pages (/blog index and /blog/:slug show) from server-rendered ERB views with React hydration to Inertia.js.

Changes

  • Controller: Updated GumroadBlog::PostsController to use inertia layout and render Inertia pages directly instead of setting @props for ERB templates
  • New Inertia Pages:
    • pages/GumroadBlog/Index.tsx - Blog listing with featured post, tag filtering, and post grid
    • pages/GumroadBlog/Show.tsx - Individual blog post view with rich text editor
  • Extracted Components: Created reusable HomeNav and HomeFooter components for consistent navigation/footer across blog pages
  • Removed: Deleted legacy ERB views (index.html.erb, show.html.erb), gumroad_blog layout, server-component PostPage.tsx, and gumroad_blog.ts pack
  • Meta Tags: Added proper meta tag handling via set_meta_tag in controller for SEO

Before/After


Test Results

 bundle exec rspec spec/controllers/gumroad_blog/posts_controller_spec.rb spec/policies/gumroad_blog/posts_policy_spec.rb spec/presenters/post_presenter_spec.rb

Screenshot 2026-01-29 at 2 39 51 PM

Checklist


AI Disclosure

IDE: Cursor
Model: Claude Sonnet 4.5
Purpose: creating migration plan

Comment on lines -4 to -6
layout "gumroad_blog"
layout "inertia"

before_action :hide_layouts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed layout from gumroad_blog to inertia and removed hide_layouts before_action since Inertia handles layouts differently.

Comment on lines 19 to 43
@@ -33,7 +36,11 @@ def index
def show
authorize @post, policy_class: GumroadBlog::PostsPolicy

@props = PostPresenter.new(pundit_user: pundit_user, post: @post, purchase_id_param: nil).post_component_props
set_meta_tag(title: @post.subject)
set_meta_tag(property: "og:title", value: @post.subject)
set_meta_tag(property: "og:description", value: @post.message_snippet)

render inertia: "GumroadBlog/Show", props: PostPresenter.new(pundit_user: pundit_user, post: @post, purchase_id_param: nil).post_component_props
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from assigning @props instance variable to directly using render inertia: with the component path GumroadBlog/Index and inline props hash.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New shared footer component extracted for reuse. Contains:

  • Social media icon SVG components (X, YouTube, Instagram, Facebook, Pinterest)
  • Email subscription form with state management
  • Navigation links using Inertia's Link component
  • Styled with Tailwind CSS matching Gumroad's home page design

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New shared navigation component extracted for reuse. Contains:

  • NavLink component for consistent navigation styling with active state support
  • GitHub stars badge that fetches from GitHub API
  • Mobile hamburger menu with toggle animation
  • Dark mode support via Tailwind's dark: prefix
  • Uses usePage() to determine active navigation item
  • Shows Dashboard link for logged-in users, or Login/Start selling for guests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Inertia page component for showing individual blog posts. Key changes from the old server component:

  • Uses usePage().props to get props from Inertia context
  • Wrapped with HomeNav and HomeFooter components
  • Uses Inertia Link for "Back to Blog" navigation
  • Removed scoped-tailwind-preflight from BackToBlog since it's already wrapped in parent
  • Added LoggedInUserLayout for consistent layout handling

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.

1 participant