One workaround would be to do the following:
In the article, paste <$link>*</$link>
(or just <$link/>
), then excise it and give it a title.
One workaround would be to do the following:
In the article, paste <$link>*</$link>
(or just <$link/>
), then excise it and give it a title.
ooh this is a really nice solution! I imagine your brain spinning radically in circles producing solutions!
To extrapolate on @Brian_Radspinner idea. If you always transclude using a template, then you can leverage the template to show some empty placeholder.
I always transclude using a custom template which shows me two small buttons, view and edit, along with every transcluded text.
If the tiddler is empty, the buttons still appear, which gives me a cue that a transcluded tiddler is missing.
I use the snippet feature to make it easy to insert the template.
Nice idea! Could you share what you put in that template?
$__talha131_Template_NavigateTranscludedTiddler.json (1.1 KB)
I had asked about this in this thread. It has some great answers.
This is amazing. Beautiful, thanks for sharing!
This is an excellent question and these are excellent solutions. I’ve also had this exact problem for a while now, so I’m glad to know I’m not the only one. Perhaps we should make a macro for this?
I find that creating a template that you use to transclude any tiddler name allows you to include logic in the template to meet any requirement.
For example create this tiddler “smart”.
<$list filter="[all[current]!has[text]]"><$link/></$list>
<$list filter="[all[current]has[text]]">
<$transclude/>
<$list filter="[{$:/config/design-mode}match[yes]]">
{{||$:/core/ui/Buttons/edit}}
</$list>
</$list>
Also create a tiddler $:/config/design-mode set to yes
Now you can use the following transclusion {{New tiddler without content||smart}}
.
The smart tiddler can be packed with all kinds of features including tooltips, buttons and more logic.
{{ selection ||smart}}
or any "smart transclusion tiddler, would be helpful.Most of times, I find that I want to be able to edit simply the transcluded content. And similarly to what have already been told, I do something like:
!! <$link to=<<transcuded>>/>
<$transclude mode=block tiddler=<<transcluded>>/>
Here’s a simple ‘preview transclusion’ macro that enables non-existent transclusions to be created as links initially, then into text transclusions on adding text in the aforementioned linked tiddlers. One could improve this further by adding some small link ‘decoration’ to the transcluded text to allow further editing of the transcluded tiddler:
\define ptransclusion(title)
<$set name="var" tiddler=<<__title__>> field="text" emptyValue="[[$title$]]">
<<var>>
</$set>
\end
With the above macro, the following will yield a wikilink to as yet unpopulated tiddler titled ‘title’:
<<ptransclusion "title">>
Adding text to that tiddler e.g. Hello world will cause the link to be replaced by the contents of tiddler titled ‘title’.
The idea of being able to show a clickable message for missing transclusions is very interesting.
There’s no easy way to accomplish this with the current core. I can see two possible implementation approaches, both of which would require JS modifications in the core:
{{tiddler}}
to generate additional code that substitutes the value of a global like tv-missing-transclusion
in case the tiddler is missing. Something like <$transclude tiddler={{{ [<targetTiddler>is[missing]then<tv-missing-transclusion>else<targetTiddler>] }}}...
tv-missing-transclusion
if it doesn’t existThe second would appear to be more efficient, but adds yet more complexity to the transclude widget, which is already about to get more complex when #6666 is merged.
The parameterised transclusion work in #6666 would provide another way to approach this: a custom widget could override the transclude widget and wrap it in the functionality outlined above. There’s an existing example of overriding the transclude widget in the pre-pre-release that could be used as the basis for this:
https://tiddlywiki.com/prerelease/parameterised-transclusions/#Visible%20Transclusions
When you click the button it creates a temporary tiddler tagged $:/tags/Macro/ViewTemplateBody containing the redefinition. Thus the modification only applies to tiddler content, and not to TiddlyWiki the user interface itself.
Thanks for the pointers Jeremy. It’s great to see transclusion becoming more useful with these core additions. I especially love the idea of making them visible and clickable for instant editing. This is some fine work.
What I would love to see and have personally are draggable transclusion blocks that I can drag around and attach to whatever tiddler text body I’m reading amd modifying on the fly. Oh, now that would be a minority report moment: dragging around and assembling pieces of reusable data ala no code style
You could set that up today with a custom template for transclusions that uses the draggable widget or provides draggable links, and a custom view template that uses the droppable widget. That would make for a fun wikitext based project for someone inclined to do some tinkering.
Yes, I was thinking along similar lines. Let’s see what we can cook up…
You could also do something similar today with Streams, though that is overkill since you likely would not be using a lot of the features related to hierarchies, keyboard handling and creation of new tiddlers.
Not at all @saqimtiaz. I use Streams extensively and I see what you’re getting at, but what I’d like do to is have this capability outside of the semistructured, outline paradigm of Streams, because I do like constructing essays out of different atomic ideas from the past.
Personally I like how Tiddlers currently manage tranclusions in core for missing tiddlers as it works for one of my purposes.
It means you can have sensative information of a topic in a seperate tiddler and use transulation to place it in the main article. You can then share a redacted version of the wiki simply by deleting all the tiddlers tagged as sensative in the copy. It would not be obvious that anything is missing unless someone goes looking (edit mode) for it.
Welcome to the community @Alan_101. That’s an important point and I’m sure we’ll work to preserve that behavior in subsequent updates.
There are a number of workarounds and possible futures discussed here, but the current out of the box behaviour has its purpose, and there are plentiful alternatives already.
Tony
I just want to say thank you to everyone who has commented and shared solutions. This, plus a few modifications, has been a big boost for me. I am now really, really excited about writing.