diff --git a/client/posts/change-the-website-favicon/index.tsx b/client/posts/change-the-website-favicon/index.tsx index e1aebc55..7ccc54d3 100644 --- a/client/posts/change-the-website-favicon/index.tsx +++ b/client/posts/change-the-website-favicon/index.tsx @@ -14,18 +14,14 @@ The following function changes the favicon to \`url\`: const setFavicon = function(url) { // Find the current favicon element const favicon = document.querySelector('link[rel="icon"]'); - if (favicon) { - // Update the new link - favicon.href = url; - } else { + if ( !favicon ) { // Create new \`link\` const link = document.createElement('link'); link.rel = 'icon'; - link.href = url; - // Append to the \`head\` element document.head.appendChild(link); } + link.href = url; }; ~~~