Customizing exportin to static HTML without buttons and tagpill

Hi. I want to export standalone HTML tiddler as-is but without tiddler toolbar buttons and tagpile. Is it possible by easy way?

Note: I am using some format tricks with Shiraz plugin and exporting tiddler as HTML preserves them in visible output, great.

Here is some guidance;

  • However I have provides a “finished solution” at the bottom, based on TiddlyWiki V5.2.5 (latest at time of reply)

Three tips for using TiddlyWiki to generate static webpages February 7, 2018 ~ giffmex

Perhaps see Creating a custom export format and clone the existing Static HTML export eg clone $:/core/templates/exporters/StaticRiver

  • Then look inside you clone to uncover what it is made up of, modify and clone or rename anything you want to alter within that.
  • Note: this tiddler is in effect a template the composes the resulting HTML file. see how it starts with <!doctype html> and ends with </body></html>?
  • However there is a chain of transclusions, below, that leads to the use of $:/core/ui/ViewTemplate (Don’t change this). I clone it in the below solution.

More details; you will see on investigation the “export static HTML” uses

  • $:/core/templates/html-tiddler
  • $:/core/templates/exporters/StaticRiver/Content
  • $:/core/templates/static-tiddler
  • and ultimately $:/core/ui/ViewTemplate and it is this that includes all viewTemplate items
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>

Worked through instructions

If you do not need to retain the existing Export Static HTML, try the following;

  • Clone $:/core/ui/ViewTemplate to Static-tiddler-export
    • Opening the Static-tiddler-export tiddlers shows you roughly what your export will look like
  • edit $:/core/templates/static-tiddler to use “Static-tiddler-export” instead, see below
<a name=<<currentTiddler>>>
<$transclude tiddler="Static-tiddler-export"/>
</a>

Now you can edit Static-tiddler-export to include only what you want.

First I exclude the existing title and tags -[[$:/core/ui/ViewTemplate/title]] -[[$:/core/ui/ViewTemplate/tags]]

  • Then I clone $:/core/ui/ViewTemplate/title to Static-tiddler-export-title
  • Modify Static-tiddler-export-title to show only what we want in the title
    • To do this I commented out the list that uses “$:/tags/ViewToolbar”
    • remove the tag $:/tags/ViewTemplate or it will appear on all tiddlers
    • add the list-before field and leave empty, this ensures our new title is at the top
  • Now lets include the Static-tiddler-export-title in the list in Static-tiddler-export.
    • place it Static-tiddler-export at the beginning

So now the list filter in Static-tiddler-export reads as follows;

"Static-tiddler-export-title [all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]] -[[$:/core/ui/ViewTemplate/title]] -[[$:/core/ui/ViewTemplate/tags]]"

Presto, Now exporting the Static HTML the Buttons and tags are not displayed.

static-tiddler-export.json (3.3 KB) modified tiddlers for your immediate use, tested on tiddlywiki.com

  • Remember replaces existing Static Tiddler export. Delete all three to restore existing.
  • There are some other tweaks I would include including removing the message at the top and making “internal links” open the full wiki, ensure the full wiki has a splash screen etc…
2 Likes

I think so!
1 Use “open in new window” rather than “export tiddler”

2 Copy contents of that “window”

3 Paste it to current TiddlyWiki (or drag and drop it) Be sure to change “Untitled” field to the name you want upon import.

4 Tiddler no longer has menu, tags, date, etc. Export THIS new tiddler to “Static HTML”.

Images, videos, audio should be preserved in your new static HTML.

Above example doesn’t work with Android. It’s probably the same with iPhones.

Here’s an even easier way:

You will need a simple text editor.

1 Export the tiddler as a .tid
2 Open with a text editor
3 Delete lines (field: value) you don’t need, such as the tags: NewTiddler, etc.
4 Save and import to TiddlyWiki
5 Export as static .html