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:installThen 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:
- Your
.envfile containsOGPLUS__API_KEY=your-key-here - You’re using a gem like
dotenv-railsto load.envfiles - You restarted your Rails server after adding the key
No og:image tags in source
If the og:image meta tag is missing:
- Verify
<%= open_graph_meta_tags %>is in your layout’s<head> - Check that the layout is being used by your controller