mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
add Twitter labels only if both properties are present
This commit is contained in:
parent
ea0e238ae1
commit
850838147a
1 changed files with 1 additions and 4 deletions
|
@ -146,12 +146,9 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
if opts[:read_time] && opts[:read_time] > 0
|
||||
if opts[:read_time] && opts[:read_time] > 0 && opts[:like_count] && opts[:like_count] > 0
|
||||
result << tag(:meta, name: 'twitter:label1', value: I18n.t("reading_time"))
|
||||
result << tag(:meta, name: 'twitter:data1', value: "#{opts[:read_time]} mins 🕑")
|
||||
end
|
||||
|
||||
if opts[:like_count] && opts[:like_count] > 0
|
||||
result << tag(:meta, name: 'twitter:label2', value: I18n.t("likes"))
|
||||
result << tag(:meta, name: 'twitter:data2', value: "#{opts[:like_count]} ❤")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue