I'm in the process of preparing for a new engineering role on a Growth team. I've worked heavily in digital marketing and growth projects, and I've worked in Rails engineering roles, but this is my first engineering role 100% focused on growth team. So, to help me acclimate to the role, I decided to analyze a few hundred top ranking webpages on growth engineering topics and extract out the most…
I've built up tons of stale branches and wanted to clean them up locally and on origin. These commands take care of that. ⚠️ Obviously, if you are working in a repo that might have historical / legacy reasons for keeping all of these branches, maybe don't run these commands without checking the branches you'll be deleting. How to Delete Local Branches That Have Been Deleted From Github / Origin…
We are approaching 400 Rails database migrations in Content Harmony and they are getting a little unwieldy in my editor sidebar. Simon Chiu has a nice rake task he posted that helps archive old database migration, and his post explains some of the reasons for doing so aside from being annoyed by scrolling. His version pushes all files into a single archive, and I wanted a variation I could run…
When you first start adding components like ViewComponents into an application, I think it's normal to start running basic commands like rails generate component Button as an easy starting point. Very quickly, you'll find that /app/components/ fills up with dozens or hundreds of files, and they rarely organize themselves nicely. I prefer to namespace components early on - usually in a shallow…
I spent much of 2024 working on modernizing Content Harmony's Rails stack. During that time, one of the bigger backlogs that had accumulated was out-of-date gem dependencies. We were on Rails 6.0.0_rc1 while Rails was working on development for Rails 8. We were on Ruby 2.5 shortly after 3.3 had been released. And to top it off, we had over 90 gems in our Gemfile that were pinned haphazardly…
On all publishing websites I have worked on, and many Rails sites, I've needed to publish static pages or collections of editorial content. Sometimes these are basic app pages, like /contact/ or /support/ , in which case it's easy enough to make a PagesController , route each static page to a view file like contact.html.erb , and move on with your day. But oftentimes these are more than basic…
I recently had to put our Content Harmony Heroku app into maintenance mode, and discovered it is possible to set a custom URL as your Maintenance Mode experience if users visit while the site is down. This is a pretty straightforward feature, but delivers a nicer branded experience when you need to put a Heroku app into maintenance mode. We recently did this on Content Harmony both for Postgres…
If you've ever set up a sitemap in Rails, you might have used the sitemap_generator gem (docs: /kjvarga/sitemap_generator ) to automatically generate an XML sitemap. On a recent client project we were generating a single sitemap for a variety of content types, including static pages, blog posts, and 2-3 custom content directories. You can imagine a basic config/sitemap.rb setup like this from the…
Recently I have been testing various SEO requirements in a Rails app that uses Rspec. After copy and pasting expect(page).to have_css "meta[name='robots'][content='noindex']", visible: :hidden for the 5th time it was clear I needed to build out some helper commands that were simpler and more clear. I came up with the following SEO Helper that lives at spec/support/seo_helper.rb . These tests are…