Chapter 5

Troubleshooting

Common issues and manual configuration

Something not working? This covers manual configuration and the most common issues.

Manual configuration

Run the basic install generator for a commented template:

rails g opengraphplus:install

Then configure manually in config/initializers/ogplus.rb:

OpenGraphPlus.configure do |config|
  config.api_key = ENV["OGPLUS__API_KEY"]
  # or
  config.api_key = Rails.application.credentials.opengraphplus.api_key
end

Common issues

Missing API key

If you see OpenGraphPlus::MissingApiKeyError, your API key isn’t configured. Check that:

  1. Your .env file contains OGPLUS__API_KEY=your-key-here
  2. You’re using a gem like dotenv-rails to load .env files
  3. You restarted your Rails server after adding the key

No og:image tags in source

If the og:image meta tag is missing:

  1. Verify <%= open_graph_meta_tags %> is in your layout’s <head>
  2. Check that the layout is being used by your controller