mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #187 from tms/blog-onebox-tweaks
Have oneboxer default to page title when og:title is missing
This commit is contained in:
commit
df63a3c516
@ -8,6 +8,11 @@ module Oneboxer
|
|||||||
node = doc.at("/html/head/meta[@property='og:#{prop}']")
|
node = doc.at("/html/head/meta[@property='og:#{prop}']")
|
||||||
result[prop] = (node['content'] || node['value']) if node
|
result[prop] = (node['content'] || node['value']) if node
|
||||||
end
|
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 there's no description, try and get one from the meta tags
|
||||||
if result['description'].blank?
|
if result['description'].blank?
|
||||||
|
Loading…
Reference in New Issue
Block a user