Framework integration

Rankveo for Rails

Publish in rankveo, render the blog on your Rails site. A mountable engine - one line in routes.rb, no models and no migrations.
rankveo-rails

Installation

Install the package in your existing Rails project.

terminal
bundle add rankveo-rails

Two steps

1

Configure the key

A blog key, available on every plan. Server-side only.

# config/initializers/rankveo.rb
Rankveo.configure do |config|
  config.api_key =
    ENV.fetch("RANKVEO_BLOG_API_KEY")
end
2

Mount the engine

Isolated, so nothing collides with your own routes or helpers.

# config/routes.rb
mount Rankveo::Rails::Engine,
      at: "/blog"
3

Or read it yourself

For pages you write by hand.

articles = Rankveo.blog.articles(page: 0)
article = Rankveo.blog.find_article(slug)

# to_param is the slug, so this works:
blog_article_path(article)

Seconds, not a rebuild

A static site generator has to rebuild and redeploy to show a new article. Rails has a real cache, so rankveo just tells it to forget what it knows.

  • Any cache store Invalidation is a version counter, not delete_matched - which memcached does not support at all.
  • Verified in constant time The bearer check ships in the gem, so nobody reimplements it wrong.
  • No secret, no route The endpoint is not drawn until you set one - an open cache-buster is a free way to hammer the API.
config.revalidate_secret =
  ENV.fetch("RANKVEO_REVALIDATE_SECRET")

# rankveo then calls, on every change:
POST /blog/rankveo/revalidate
Authorization: Bearer ...

{"revalidated": true, "slug": "..."}

Worth knowing before you start

Overriding is one file Your application’s view paths win over an engine’s, so app/views/rankveo/blog/index.html.erb in your repo replaces the packaged one. No forking, no publish step.
Cached as hashes, not Structs Rails.cache marshals values, and a marshalled Struct breaks on load the first time a member is added. Objects are rebuilt on read instead.
The client works outside Rails Rankveo::Blog::Client is plain Ruby with no Rails dependencies, so the same class runs in a rake task or a script.
Sitemap with image entries Google will not index an image it has to find by crawling. Generic sitemap gems emit only <loc>.