1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-06-27 07:32:58 +00:00

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

This commit is contained in:
jeremy@jermolene.com 2020-04-22 16:40:02 +01:00
parent 5f98e7d7b3
commit 2a8f7a9c50
2 changed files with 8 additions and 2 deletions

View File

@ -36,8 +36,12 @@ function setFavicon() {
var tiddler = $tw.wiki.getTiddler(FAVICON_TITLE); var tiddler = $tw.wiki.getTiddler(FAVICON_TITLE);
if(tiddler) { if(tiddler) {
var faviconLink = document.getElementById("faviconLink"); var faviconLink = document.getElementById("faviconLink");
if(tiddler.fields._canonical_uri) {
faviconLink.setAttribute("href",tiddler.fields._canonical_uri);
} else {
faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text); faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text);
} }
}
} }
})(); })();

View File

@ -1,5 +1,5 @@
created: 20131224074240979 created: 20131224074240979
modified: 20140912142228347 modified: 20200422163752597
tags: [[Customise TiddlyWiki]] tags: [[Customise TiddlyWiki]]
title: Setting a favicon title: Setting a favicon
type: text/vnd.tiddlywiki 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. 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 ! favicons on the Server
On the server, the ServerCommand will serve the tiddler [[$:/favicon.ico]] at the path `/favicon.ico`. On the server, the ServerCommand will serve the tiddler [[$:/favicon.ico]] at the path `/favicon.ico`.