…and see whether it is a tag?
[{$:/info/url/full}split[#]last[]is[tag]]
does not seem to work…
Which tag are you using for the startup? it may make a difference if the info is available yet. why do you ask is tag?
I want to use this to display tiddlers tagged with the tag with a dynamic TOC.
<$list filter="[{$:/info/url/full}split[#]last[]]" >
{{!!title}}
<$action-setfield $tiddler="$:/temp/multimenu/active" parent={{!!title}}/>
</$list>
Hi @TW_Tones , I solved this with a trick I learned from you.
<$list filter="[{$:/info/url/search}removeprefix[?tag=]decodeuri[]]" >
{{!!title}}
<$action-setfield $tiddler="$:/temp/multimenu/active" parent={{!!title}}/>
</$list>
This came up in the last few months and was not evident immediately how we can access the tiddler name, but I think we found a work around in that case. I can have a further look tomorrow soon.
So good night to Australia…
I still wonder how I can sense whether there is a permalink in the url from within the wiki.
For another usecase I would like to stop some startupactions if the URL contains a permalink
Currently, the TWCore $:/info/url/full
tiddler automatically trims off any permalink/permaview.
See $:/core/modules/info/platform.js:
setLocationProperty("full", (location.toString()).split("#")[0]);
To address this, I’ve created a new “info” module, TiddlyTools/Modules/Info/Permaview.js, which creates $:/info/url/permaview
, with the following code:
exports.getInfoTiddlerFields = function() {
var info=[];
if ($tw.browser) info.push({title:"$:/info/url/permaview",
text:decodeURIComponent(location.toString().split("#")[1]||"")});
return info;
};
Install the above module into your TiddlyWiki and save-and-reload for it to take effect. Then, you can reference {{$:/info/url/permaview}}
in your startup
module to get the URI-decoded value of the URL permalink/permaview.
Note that $:/info/url/permaview
will contain the permalink/permaview value that was used when the TiddlyWiki is initially loaded into your browser, and is NOT updated if you use the “permalink” or “permaview” menu/sidebar commands or have set the $:/ControlPanel > Settings
“Navigation Address Bar” options to enable automatic updates to the browser’s “address bar” when navigating to a tiddler.
Let me know how it goes…
enjoy,
-e
Hi @EricShulman again an invention so usefull that I would like to see this in the core!
I renamed the thread so that it can be found more easily
Aah, I realized a problem for my UseCase:
Is it so o that if I start with a list of defaulttiddlers but without permalink
$:/info/url/permaview
is not empty but gets filled with the defaulttiddlers?
$:/info/url/permaview gets the permalink if there is one.
But I would like the startupaction-tiddler to perform an action if there is no # in the url…and this does not seem to work
If there is no permalink/permaview in the URL, then $:/info/url/permaview
will be blank. That seems to be the proper result, regardless of any $:/DefaultTiddlers.
I would think that to handle your particular use case, your startupaction-tiddler should explicitly check for either case.
Something like this:
<$list filter="[{$:/info/url/permaview}!match[]] ~[{$:/DefaultTiddlers}!match[]]">
... perform actions if either permaview or default tiddlers are present ...
</$list>
or, if you want to perform actions FOR EACH specified tiddler, you could write something like this:
<$list filter="[enlist{$:/info/url/permaview}] ~[subfilter{$:/DefaultTiddlers}]">
... perform actions for each permaview tiddler or default tiddler...
</$list>
-e
@EricShulman nice solution. Recently there was a discussion on a related method. If I understand correctly this solution will store the tiddler names for subsequent access or reference. Then tiddlywikis behaviour is to go ahead and open them and not the default tiddlers.
- can you see a way to stop this tiddler opening behaviour while still trapping the tiddlers on the url?
TiddlyTools/Modules/Info/Permaview.js saves everything after the #
in the URL. For a permaLINK, it is just a single tiddler title.
However, for a permaVIEW, it is a list of tiddler titles, preceded by the title of the "current tiddler" (as determined by the $:/HistoryList!!current-tiddler
value at the time that the permalink was created). Thus, if you open three tiddlers named “A”, “B”, and “C”, and you use the permaview menu item, the resultant URL will contain something like: ...#C:A B C
.
When you open this URL-with-permaview, it will perform three actions to process the permaview:
- display tiddlers A, B and C
- set
$:/HistoryList!!current-tiddler
to “C” - navigate to tiddler C (scrolling as needed to ensure it is visible)
If you edit the permaview to remove the leading “C:”, then the remaining URL will be seen as containing a permalink to a tiddler named “A B C”, rather than three separate titles.
Thanks for the details, but If I am using your method to set the $:/info/url/permaview and thus harvest the titles in the URL, I am wondering if we can stop the wikiopening them, and do something else, like open the default tiddlers?
- I would then code some method to handle the tiddlers on the URL
- Perhaps it would be better to create a URL with these extra tiddlers in the search
?
part of the URL, but I just thought we could use the existing mechanisium.
Why;
- I may want to open a wiki while passing a set of tiddler titles to list or action in some way.