Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions client/posts/change-the-website-favicon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
~~~

Expand Down