Modifying Static HTML export to direct users back to interactive wiki

106 views
Skip to first unread message

TonyM

unread,
Apr 23, 2019, 12:45:09 AM4/23/19
to TiddlyWiki
Folks,

It is possible to export a tiddler as "Static HTML". This allows a tiddler to be published separately from the WIki as a whole and can be rendered in its own right?

The links within a static tiddler (to other Tiddlers) get changed to be "The Static HTML Tiddler#tiddlername" which is more often than not invalid.

I am wondering if anyone has identified how to edit or clone the the export Static HTML process/template to instead have the links within Static HTML tiddlers to refer to the originating or specified TiddlyWiki.  My attempts to follow the process on Tiddlywiki.com are throwing error messages.

For example If I were at https://tiddlywiki.com/#HTML%20in%20WikiText and I exported this tiddler as a Static HTML tiddler, it would create a html file called "HTML%20in%20WikiText.html" however IF the title of this tiddler would link to https://tiddlywiki.com/#HTML%20in%20WikiText and any "internal wiki links" within the static HTML tiddler would link to https://tiddlywiki.com/#tiddlername this would mean,

If you land on a static HTML page and click any active link you would either;
  • Go to or open an external link address
  • Or if the link is an internal one, load the full Wiki and navigate to the tiddlername.
We can see that tiddlywiki.com has a folder tiddlywiki.com/static and every internal link, links to another html page tiddlywiki.com/static/tiddlername.html file. In this case all tiddlers need to be exported as static html to remain valid.
I believe this is done via a batch server command.

If this feature to export Static HTML tiddlers, for which internal links refer back to the full wiki, it would be possible to export only select tiddlers that would be visible in search engines etc.. yet on clicking a link will redirect the user to the full interactive wiki. This seems to me a Quick and easy way to draw people to content but automatically drive them to the full interactive wiki. 

If such selectively static HTML published tiddlers are placed in a known location such as mydomain.com/static, as tiddlywiki.com does, we could create a button that can open such tiddlers Static HTML version in another tab without loading the full wiki, and users could bookmark these as references, while being able to open the interactive wiki if desired.

Thanks for your Feedback in advance
Tony

Jeremy Ruston

unread,
Apr 24, 2019, 5:54:02 AM4/24/19
to tiddl...@googlegroups.com
Hi Tony

The link widget offers several options for generating the href of links — see “HREF Generation”:


In particular, see the docs for the variable tv-wikilink-template:


To create a custom static HTML exporter that routes wikilinks back to a wiki in a file called index.html:

1. Locate the shadow tiddler $:/core/templates/exporters/StaticRiver and open it
2. Clone it to create a new tiddler called "$:/core/templates/exporters/StaticRiverWithWikiLinks”
3. Set the description field of the clone to "Static HTML with wiki links”
4. Modify the first line of the tiddler from "\define tv-wikilink-template() #$uri_encoded$” to "\define tv-wikilink-template() index.html#$uri_encoded$”
5. Save the tiddler

Now, when you click “export” on a tiddler you’ll see the additional export option. A link to “HelloThere” will be transformed to a link to “index.html#HelloThere”.

Let me know how you get on,

Best wishes

Jeremy


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/01651eae-2b8f-4e74-b2c5-b76e19fcdc1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Apr 24, 2019, 8:08:02 AM4/24/19
to TiddlyWiki
Jeremy,

Thanks for a detailed answer I will implement it on return to my desk. I may extend it to use the current wikis filename and domain from the info tiddlers rather than only index.html

Extending applications of tiddlywiki to generate such static tiddlers, that can open a full tiddlywiki by design, could be a boon to site development and SEO.

With additional templates, A tiddlywiki could also generate html pages, php or whole sites automatically after the designer provides key information.

Once again tiddlywiki exposes yet another almost infinite set of possibilities.

I think my preferred term "TiddlyWiki platform" is still too restrictive when it can also be an SDK software development kit, a site generator and more.

Thanks again and regards
Tony

Mohammad

unread,
May 4, 2020, 4:19:07 AM5/4/20
to TiddlyWiki
Hi Jeremy,
 This is a wonderful trick to activate the links to main tiddlywiki.com!

My question is:

Exporting to a static.html using official template ($:/core/templates/static.template.html) and  "tiddlywiki --build  static" is it possible to activate links by 
modifying tv-wikilink-template like  \define tv-wikilink-template() #$uri_encoded$
In other words static.html contains all tiddlers rendered in a single html file and activating links means clicking a tiddler link will bring it under focus!


--Mohammad

p.s: the standard static command is the one generated by tiddlywiki mywiki --init server as below

    "static": [
            "--rendertiddler",
            "$:/core/templates/static.template.html",
            "static.html",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/alltiddlers.template.html",
            "alltiddlers.html",
            "text/plain",
            "--rendertiddlers",
            "[!is[system]]",
            "$:/core/templates/static.tiddler.html",
            "static",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/static.template.css",
            "static/static.css",
            "text/plain"
        ]





On Wednesday, April 24, 2019 at 2:24:02 PM UTC+4:30, Jeremy Ruston wrote:
Hi Tony

The link widget offers several options for generating the href of links — see “HREF Generation”:


In particular, see the docs for the variable tv-wikilink-template:


To create a custom static HTML exporter that routes wikilinks back to a wiki in a file called index.html:

1. Locate the shadow tiddler $:/core/templates/exporters/StaticRiver and open it
2. Clone it to create a new tiddler called "$:/core/templates/exporters/StaticRiverWithWikiLinks”
3. Set the description field of the clone to "Static HTML with wiki links”
4. Modify the first line of the tiddler from "\define tv-wikilink-template() #$uri_encoded$” to "\define tv-wikilink-template() index.html#$uri_encoded$”
5. Save the tiddler

Now, when you click “export” on a tiddler you’ll see the additional export option. A link to “HelloThere” will be transformed to a link to “index.html#HelloThere”.

Let me know how you get on,

Best wishes

Jeremy
On 23 Apr 2019, at 05:45, TonyM <anthon...@gmail.com> wrote:

Folks,

It is possible to export a tiddler as "Static HTML". This allows a tiddler to be published separately from the WIki as a whole and can be rendered in its own right?

The links within a static tiddler (to other Tiddlers) get changed to be "The Static HTML Tiddler#tiddlername" which is more often than not invalid.

I am wondering if anyone has identified how to edit or clone the the export Static HTML process/template to instead have the links within Static HTML tiddlers to refer to the originating or specified TiddlyWiki.  My attempts to follow the process on Tiddlywiki.com are throwing error messages.

For example If I were at https://tiddlywiki.com/#HTML%20in%20WikiText and I exported this tiddler as a Static HTML tiddler, it would create a html file called "HTML%20in%20WikiText.html" however IF the title of this tiddler would link to https://tiddlywiki.com/#HTML%20in%20WikiText and any "internal wiki links" within the static HTML tiddler would link to https://tiddlywiki.com/#tiddlername this would mean,

If you land on a static HTML page and click any active link you would either;
  • Go to or open an external link address
  • Or if the link is an internal one, load the full Wiki and navigate to the tiddlername.
We can see that tiddlywiki.com has a folder tiddlywiki.com/static and every internal link, links to another html page tiddlywiki.com/static/tiddlername.html file. In this case all tiddlers need to be exported as static html to remain valid.
I believe this is done via a batch server command.

If this feature to export Static HTML tiddlers, for which internal links refer back to the full wiki, it would be possible to export only select tiddlers that would be visible in search engines etc.. yet on clicking a link will redirect the user to the full interactive wiki. This seems to me a Quick and easy way to draw people to content but automatically drive them to the full interactive wiki. 

If such selectively static HTML published tiddlers are placed in a known location such as mydomain.com/static, as tiddlywiki.com does, we could create a button that can open such tiddlers Static HTML version in another tab without loading the full wiki, and users could bookmark these as references, while being able to open the interactive wiki if desired.

Thanks for your Feedback in advance
Tony


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages