From 2a819546ae47c0dbe8ae3019add09e1a263600b2 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 7 Jan 2016 14:30:13 +0530 Subject: [PATCH] add Twitter label meta tags only if value is present --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c60a625136..59d83fe238d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -146,12 +146,12 @@ module ApplicationHelper end end - if opts[:read_time] + if opts[:read_time] && opts[:read_time] > 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] + 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