From 850838147a89722666f9d6ee96173b991af88ea7 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 7 Jan 2016 16:48:05 +0530 Subject: [PATCH] add Twitter labels only if both properties are present --- app/helpers/application_helper.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 59d83fe23..d8b9634dc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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