Skip to main content

tiddlywebplugins.urls

This plugin lets you:

  • Map a custom URL to a default TiddlyWeb URL.

  • Map a custom URL to any other URL, for use as a URL shortener

It uses selector syntax for the custom URL (http://lukearno.com/projects/selector/)

Configuration

This plugin is a “system” and a “twanager” plugin. Type twanager usage in the command line. Your tiddlywebconfig.py should look similar to this configuration:

config = {
'system_plugins': ['tiddlywebwiki', 'tiddlywebplugins.urls' ],
'secret': 'XXXXXXXX',
'twanager_plugins': ['tiddlywebwiki', 'tiddlywebplugins.urls'],

# the tiddlywebwiki.friendlywiki function doesn't work with urls plugin,

# it needs to be disabled.
'tiddlywebwiki.friendlywiki': False,

#'url_bag':'__urls',
}

Note: All urls are stored in a bag called “urls” by default.

The name of this bag can be changed by adding “urls_bag” to tiddlywebconfig.py, but all tiddlers in the bag must be “url tiddlers” of the described format. If this bag doesn’t exists already, it will be created automatically.

Rewrite URLs

To bring up a tiddlywiki at /default, create a tiddler like:

title:
/default

text:
/recipes/default/tiddlers.wiki

This configuration creates a link eg: http://example.com/default that would otherwise be: http://example.com/recipes/default/tiddlers.wiki, which is still valid. Be sure the recipe named “default” exists!

Flexible Version

Using the above format you’d need to create one tiddler per recipe. This isn’t very “user friendly”. So we need to be more flexibe, using “placeholders” to define the relation. Now we want to map every recipe_name, that the user may enter eg: /wiki/anyRecipeName:

title:
/wiki/{recipe_name:segment}

text:
/recipes/{{ recipe_name }}/tiddlers.wiki

A URL http://example.com/wiki/myWiki will load http://example.com/recipes/myWiki/tiddlers.wiki

Redirect URLs

Redirect to internal URL

If you want to redirect instead of rewrite to an internal URL, you can add the tag “redirect”:

title:
/wiki/{user:segment}

tags:
redirect

text:
/recipes/{{ user }}/tiddlers.wiki

Be aware, that adding a user will not automatically add a user recipe. So if you need one, you need to create it.

Redirect to exernal URL

To create a short link to google.com, you might do the following. There is no need for the “redirect” tag:

title:
/google

text:
http://www.google.com

Experimental

If we create a tiddlywiki with a bag eg: /bags/{{ bag_name }}/tiddlers.wiki it will be loaded as a TiddlyWiki representation, but it is not saveable:

title:
/test/{bag_name:segment}

text:
/recipes/experiment/tiddlers.wiki

The experiment recipe needs to look similar to this one (in production you’ll need access rights!):

desc: some description text ...
policy: {"read": [], "create": [], "manage": [R:ADMIN], "write": [], "owner": null, "delete": []}

/bags/system/tiddlers
/bags/{{ bag_name }}/tiddlers

Where bag_name can be any variable name.

Note that this does not support PUTs, you are unable to PUT to the recipe (unless you provide a default for bag_name). This version needs a client side plugin to work with PUTs.

Release files for tiddlywebplugins.urls 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tiddlywebplugins.urls 0.6.1
File Size Uploaded
tiddlywebplugins.urls-0.6.1.tar.gz 12.1 kB Details

Release files / tiddlywebplugins.urls-0.6.1.tar.gz

Download URL tiddlywebplugins.urls-0.6.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ce1ea900411404cc02d0bea21030a0b50458fa7db62c5c0b306646eb3ede113d
BLAKE2b-256 checksum
How to use checksums
a7783531edd10e7ef6861e28fa9a5df71823a892a5ef5799f80827c9ddc538b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.6.1 This release

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page