From 38f50d3bcc035f5ac1bd5040b8de76999f82e308 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Fri, 2 Oct 2015 10:12:58 +1000
Subject: [PATCH] FIX: stop rendering blank urls for icons

You get an instant double request if you allow rendering of "" as
a favicon or apple touch icon.
---
 app/views/layouts/_head.html.erb | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb
index a74f93bafe9..0843f71338c 100644
--- a/app/views/layouts/_head.html.erb
+++ b/app/views/layouts/_head.html.erb
@@ -1,13 +1,14 @@
 <meta name="author" content="">
 <meta name="generator" content="Discourse <%= Discourse::VERSION::STRING %> - https://github.com/discourse/discourse version <%= Discourse.git_version %>">
-
+<%- if SiteSetting.favicon_url.present? %>
 <link rel="icon" type="image/png" href="<%=SiteSetting.favicon_url%>">
+<%- end %>
+<%- if SiteSetting.apple_touch_icon_url.present? %>
 <link rel="apple-touch-icon" type="image/png" href="<%=SiteSetting.apple_touch_icon_url%>">
-<% if SiteSetting.apple_touch_icon_url != "/images/default-apple-touch-icon.png" %>
+<%- end %>
+<%- if (SiteSetting.apple_touch_icon_url != "/images/default-apple-touch-icon.png") && SiteSetting.apple_touch_icon_url.present? %>
 <link rel="icon" sizes="144x144" href="<%=SiteSetting.apple_touch_icon_url%>">
-<% end %>
+<%- end %>
 <meta name="theme-color" content="#<%= ColorScheme.hex_for_name('header_background') %>">
-
 <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes">
-
 <%= canonical_link_tag %>