And assuming they are, so that refreshPageTitle does get called when
document.title is changed, shouldn't saveChanges() simply read the
current document.title in stead of the expression
'wikifyPlain("SiteTitle") + " - " + wikifyPlain("SiteSubtitle")' ?
And given that one might not want the document title to be built quite
the way it is, I suggest:
config.shadowTiddlers.DocumentTitle = "{{wikifyPlain('SiteTitle') +
' - ' + wikifyPlain('SiteSubtitle')}}";
function refreshPageTitle()
{
document.title =
store.getTiddlerText("DocumentTitle").readMacroParams();
}
config.notifyTiddlers = [
{name: "StyleSheetLayout", notify: refreshStyles},
{name: "StyleSheetColors", notify: refreshStyles},
{name: "StyleSheet", notify: refreshStyles},
{name: "StyleSheetPrint", notify: refreshStyles},
{name: "PageTemplate", notify: refreshPageTemplate},
{name: "SiteTitle", notify: refreshPageTitle},
{name: "SiteSubtitle", notify: refreshPageTitle},
{name: "DocumentTitle", notify: refreshPageTitle},
{name: null, notify: refreshDisplay}
];
The effect is the same, unless you define your own DocumentTitle
tiddler.
Isn't that refreshing ?
:-) Poul Staugaard
Gosh, yes, they should be, and of course they were until 1.2.39, for
some inexplicable reason the call to refreshPageTitle() got lost in
the transition to 2.0.0. I'll raise a ticket to restore the earlier
behaviour.
> And assuming they are, so that refreshPageTitle does get called when
> document.title is changed, shouldn't saveChanges() simply read the
> current document.title in stead of the expression
> 'wikifyPlain("SiteTitle") + " - " + wikifyPlain("SiteSubtitle")' ?
I considered this optimisation but felt that it saves very little, and
was actually slightly more brittle as it sets up a dependency between
fairly unrelated chunks of code. I also didn't want to assume that
document.title always reads back exactly as it was set (eg, if
document.title couldn't cope with the full unicode character set
because of a host OS window title dependency).
> And given that one might not want the document title to be built quite
> the way it is, I suggest:
>
> config.shadowTiddlers.DocumentTitle = "{{wikifyPlain('SiteTitle') +
> ' - ' + wikifyPlain('SiteSubtitle')}}";
I think it's more consistent with existing TW practices to do something like:
config.title = "%0 - %1";
Cheers, and thanks for your help,
Jeremy.
--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com
A related issue is what google chooses to extract and present in its
search results. I suppose you would be advised to put the
DefaultTiddlers at the top.
:-) Poul
I was suggesting it would be processed with String.format(), like some
of the other strings in the config.messages.* block, but on reflection
I'm not sure that I don't prefer your suggestion of using a shadow
tiddler. One could avoid the macro parameter call, and have it
wikified in the normal way by expressing the default value as:
<<tiddler SiteTitle>> - <<tiddler SiteSubtitle>>
> A related issue is what google chooses to extract and present in its
> search results. I suppose you would be advised to put the
> DefaultTiddlers at the top.
Google-friendliness is one of the reasons that saveChanges() goes to
the trouble of stitching the real title into the generated HTML file,
rather than relying on processing on onload() to assign it dynamically
when the page is loaded.
There's a ticket about moving the content around for the benefit of
search engines:
http://trac.tiddlywiki.org/tiddlywiki/ticket/2
I've updated it with your point about the DefaultTiddlers.
Cheers
Jeremy.
>
> :-) Poul