From 2a8f7a9c503c9a6e4ea1bcd116be31ab6e90cf52 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Wed, 22 Apr 2020 16:40:02 +0100 Subject: [PATCH] Add support for _canonical_uri field of $:/favicon.ico --- core/modules/startup/favicon.js | 6 +++++- editions/tw5.com/tiddlers/howtos/Setting a favicon.tid | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/modules/startup/favicon.js b/core/modules/startup/favicon.js index 0d1792ea7..5adcec646 100644 --- a/core/modules/startup/favicon.js +++ b/core/modules/startup/favicon.js @@ -36,7 +36,11 @@ function setFavicon() { var tiddler = $tw.wiki.getTiddler(FAVICON_TITLE); if(tiddler) { var faviconLink = document.getElementById("faviconLink"); - faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text); + if(tiddler.fields._canonical_uri) { + faviconLink.setAttribute("href",tiddler.fields._canonical_uri); + } else { + faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text); + } } } diff --git a/editions/tw5.com/tiddlers/howtos/Setting a favicon.tid b/editions/tw5.com/tiddlers/howtos/Setting a favicon.tid index 7f83bb825..a18dbfd55 100644 --- a/editions/tw5.com/tiddlers/howtos/Setting a favicon.tid +++ b/editions/tw5.com/tiddlers/howtos/Setting a favicon.tid @@ -1,5 +1,5 @@ created: 20131224074240979 -modified: 20140912142228347 +modified: 20200422163752597 tags: [[Customise TiddlyWiki]] title: Setting a favicon type: text/vnd.tiddlywiki @@ -10,6 +10,8 @@ type: text/vnd.tiddlywiki When TiddlyWiki starts up in the browser it looks for a tiddler called [[$:/favicon.ico]] and dynamically uses it as the favicon for the page. If you modify the image then the favicon changes instantly to reflect it. +<<.from-version "5.1.23">> To set an external image as the favicon, assign the URL to the ''_canonical_uri'' field of the [[$:/favicon.ico]] tiddler. + ! favicons on the Server On the server, the ServerCommand will serve the tiddler [[$:/favicon.ico]] at the path `/favicon.ico`.