Inserting tags and title into the body of the tiddler

This is, I think, simple, and I’m just not getting it…

I have reviewed Filters — filter and list examples and mucked around, and well, I’m here asking instead :slight_smile:

I’d like to have a snippet of text, that when inserted into a tiddler, puts the tags and title of the current tiddler plus some arbitrary static text into the body of the tiddler.

For example, if I create a tiddler with a title of ‘Fred Read’ and tags of ‘ToDo’ and ‘Reading’, I’d like

----
arbitrary starting 'ToDo' text 'Reading' 'Fred Read'

to show in the body. I don’t need links, or a table or anything fancy.

Can someone give me a very simple starting point I can build on?

Welcome!
I’m not sure, why you want to have tags and title 2 times displayed with a tiddler. The title and that tags are always at the top of the tiddler.

You can create a tiddler eg: myFooter tagged: $:/tags/ViewTemplate add a field list-after: $:/core/ui/ViewTemplate/body

title: myFooter
tags: $:/tags/ViewTemplate
list-after: $:/core/ui/ViewTemplate/body

<hr>
some arbitrary text
<$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop" join=", "/>
 more text {{!!title}}

You can download and import the following tiddler into your wiki.

myFooter.json (332 Bytes)

The footer will be shown at the end of every tiddler that is open.

hope that helps
-mario

1 Like

If you really mean “snippet” (which is a technical term for something you can use in edit mode from the “stamp” icon button), try something like this:

The tag $:/tags/TextEditor/Snippet is a special one that will add your snippet to taht dropdown. The caption field determined how the entry will look in the dropdown:

image

2 Likes

Thanks for your comments… I’m not quite there yet.

This code does make a list of current tags, but it “makes them tags” with colours and borders and linkable. I want a plain text output.

<$list filter="[<currentTiddler>tags[]]">
{{||$:/core/ui/TagTemplate}}
</$list>

It seems like I have to have a template - I tried a few just looking through the shadow tiddlers with template in their name and no luck

Sorry, I thought I was helping by including something that might be nice. Of course you don’t need to apply that template (if you don’t want to help make it obvious that these are tags).

To get the tags as links you can do this:

<$list filter="[<currentTiddler>tags[]]"/>

If you want these tag terms not to show as links (but just “dumb” text) you can present them within the text widget:

<$text text={{{ [<currentTiddler>tags[]join[ • ]] }}}/>

(Replace the bullet with a space, or whatever you want, to show all the tag words without having them run together.)

You could also make a tiddler that inserts this content when you type it as a function:

Make a tiddler with any title you like, tag it $:/tags/Global, and set it up something like this:

\function tag-words() Tags here at [<currentTiddler>] include [<currentTiddler>tags[]join[, ]] +[join[ ]]

(Modify however you like, or follow up to clarify your needs)

Then typing <<tag-words>> in any tiddler will give you a comma-delimited list of the current tiddler’s tags, just as plain text (with the lead-up of "Tags here at [title-of-tiddler] include ").

Oh…

# this works
<$list filter="[<currentTiddler>tags[]]"/>

# this doesn't
<$list filter="[<currentTiddler>tags[]]">
</$list>

# wha???

I’m finding this mix of html-ish stuff with javascript(?) and tiddlywiki very counter-intuitive

Your other suggestion sounds like what I want, but I can’t get any output out of

# my try
<$text text={{{ [<currentTiddler>tags[]join[-]] }}}/>
# yours, copy pasted
<$text text={{{ [<currentTiddler>tags[]join[ • ]] }}}/>

I did appreciate the ‘snippet’ info - and yes, I was going there in the end, but trying to get the output first.

Your most recent comment about function is also interesting. But I can’t get the basic part to work :confused:

Where’s the best place to find out about $list and $text ? I’m not sure even of the correct terminology.

I’m not sure what to think, here. I just double-checked by copy-pasting the above into a new tiddler at tiddlywiki.com (adding only a newline before the second # mark, and it works fine:

List Widget documentation

Text widget documentation

Others may have more tutorial-like recommendations. Mostly, I recommend just playing around, starting with easy examples, and building gradually as you gain confidence.

The second one has failed to specify what should be shown for each item in the list. What you want to show for each item goes within the space between the opening and closing widget-tags. Put anything in there — {{!!title}} or item or <li>item</li> — and you’ll see that output for each result of your filter.

Of course, the first version doesn’t say what to show either :grin: … but Jeremy (and other developer-collaborators) often thinks of ways to make it easy for people to do obvious things. So a list widget that just closes itself (ending in />) has been set up to offer this default behavior: displaying a list of links, one for each result of the filter condition.

¯_(ツ)_/¯
Version difference?

Thanks for the self closing vs separate closing info - it’s a ‘feature’ not a bug I guess :slight_smile:

I just tried it going back to a v5.2.2, without trouble (though the function approach certainly depends on recent versions)

If the basic text-widget version isn’t working for you because of a version difference then you have something extremely… vintage! What version of TW are you working with??

Ah, 5.1.14 looks like…

It’s got a bunch of add ons I installed a while ago, and it works just fine (until now) so I’ve not updated.

I tried the https://tiddlywiki.com/upgrade.html upgrader on it, and while it said it was ok, it throws an error when you open the updated file.

I guess I’d better start with a clean file and see which plug-ins are causing a problem.

Bah - I think I’m ready to give up.
The main thing I use TW for is with the ToDoNow plugin
The newest version of that plug in isn’t handling daily repeating tasks like the old one did, and there are other changes I’m not thrilled with either. I did get it working with the current TW, and the test you and I were working on DOES work with that version, but my todo stuff doesn’t.

Of course, whether to follow up is up to you.

I don’t know the ToDoNow plugin, but I’m pretty sure there will be folks here who can help with that, if you post a separate thread!

Wishing you the best with it. I know for my own part, TiddlyWiki makes things possible that I couldn’t even imagine when I started. But it was a learning curve!

If you are using the relink plugin update it to stop an error after the core update.

Don’t give up now. You are trying to modify an old version and as a result having problems.

The kind of thing you want do do is an everyday requirement. Solving it is just part of your learning journey.

  • A valuable investment in your time.

Note widgets such as $list are not JavaScript .but what I call tiddlywiki script and you need something if you want to tell any software to do such things. Tiddlywiki provides its own subset of widgets to do almost anything.