Blog by Rails app

Look how simple my blog is:

# frozen_string_literal: true

class PostsController < ApplicationController
  def index
    @posts = Post.newest_first
    kache(@posts)
  end

  def show
    @post = Post.find_by(slug: params[:id]) || not_found
    kache(@post)
  end

  private

  def kache(resource)
    set_expires_in_a_week
    fresh_when(resource)
  end
end
// Ruby Slim for View
- cache @post.cache_key do
  article.grid-container itemscope="" itemtype="https://schema.org/BlogPosting"
    header.grid-centered.centered.mobile-left
      h1.title itemprop="name" = @post.title
      = render "application/meta", post: @post, cached: true
    .content.grid-container.grid-item.grid-reading itemprop="articleBody"
      = markdown_to_html(@post.body)
      = render "application/last_updated_at", post: @post, cached: true

Although Heroku makes it slow (HTTP2?), but it is not so much slower than static pages (I have no analytics, and put CloudFront in front).