From 85b0c0afab16f118d0586f526596872f8d0f5985 Mon Sep 17 00:00:00 2001 From: tms Date: Sun, 17 Feb 2013 04:31:21 -0500 Subject: [PATCH] Have oneboxer default to page title when og:title is missing --- lib/oneboxer/base.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/oneboxer/base.rb b/lib/oneboxer/base.rb index fa0891e2310..2d1a160c157 100644 --- a/lib/oneboxer/base.rb +++ b/lib/oneboxer/base.rb @@ -8,6 +8,11 @@ module Oneboxer node = doc.at("/html/head/meta[@property='og:#{prop}']") result[prop] = (node['content'] || node['value']) if node end + + # If there's no title, try using the page's title + if result['title'].blank? + result['title'] = doc.title + end # If there's no description, try and get one from the meta tags if result['description'].blank?