mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Have oneboxer default to page title when og:title is missing
This commit is contained in:
parent
921c3f016f
commit
85b0c0afab
1 changed files with 5 additions and 0 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue