Add support for _canonical_uri field of $:/favicon.ico

optimising-macrocalls
jeremy@jermolene.com 2020-04-22 16:40:02 +01:00
rodzic 5f98e7d7b3
commit 2a8f7a9c50
2 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -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);
}
}
}

Wyświetl plik

@ -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`.