How to do transclsion in raw HTML?

56 views
Skip to first unread message

talha131

unread,
Sep 12, 2020, 12:19:48 PM9/12/20
to TiddlyWiki

I added a video to the TW using _canonical_url.

Now I want to link to that video in a tiddler body.

When it is images, the following syntax works

[img[ImageTiddler]]

But to embed video, I have to use raw HTML

<video controls width="250">
    <source src="[[Video Tiddler]]"
            type="video/mp4">
</video>

This does not work.

So how do I transclude the video tiddler inside src attribute?

Saq Imtiaz

unread,
Sep 12, 2020, 12:58:23 PM9/12/20
to TiddlyWiki
Please see the section on "Transcluded Attribute Values" at https://tiddlywiki.com/#HTML%20in%20WikiText

talha131

unread,
Sep 12, 2020, 1:09:15 PM9/12/20
to TiddlyWiki

Thank you Saq. I read the doc you linked to.

I tried

{{Test Video}}

It embeds the video into the tiddler.

But when I tried using {{}} in raw HTML as described in Transcluded Attribute Values, it did not work.

<video controls width="250">
    <source src={{Test}}
            type="video/mp4">
</video>

The HTML it generates is

<video controls="true" width="250"><p><source src="" type="video/mp4"> </p></video>

As you can see the src value is empty.

Saq Imtiaz

unread,
Sep 12, 2020, 1:22:34 PM9/12/20
to TiddlyWiki
Assuming you saved the video location in a _canonical_uri field, try the form:

attr={{tiddler!!field}}

talha131

unread,
Sep 12, 2020, 1:27:34 PM9/12/20
to TiddlyWiki

Thank you Saq. Now it’s clear, and I am so sorry for wasting your time. I should have picked the hint from your first answer.

This worked.

<video controls width="250">
    <source src={{Test!!_canonical_uri}}
            type="video/mp4">
</video>

Saq Imtiaz

unread,
Sep 12, 2020, 1:31:51 PM9/12/20
to TiddlyWiki
No worries, glad it helped.
Reply all
Reply to author
Forward
0 new messages