Hello!
In fact, I am now trying to fix this and have already done some work. I understand this might be a bit in vain, as there are upcoming changes to the core, but I really dislike seeing so many spaces in my URLs and my use case is a bit different from what I’ve seen so far - it seems like almost everyone is going for exporting Tiddlywikies, and not generating static websites.
Your approach does work, yes, but I would really prefer not to slug my titles and have real titles; the other way around makes much more sense to me (and it’s more natural) to have a proper title and an associated slug field.
I am generating my own slugs (of course, I might run into trouble, like collisions and such), and am currently looking into how to hijack the exporting tool to use the my-slug
field to generate filenames (I expect my-slug.html
) instead of using $uri_doubleencoded$
. I feel really close to a solution!
(I know this is a bit of a big resurrection of an old thread; please let me know if this is not okay.
I’d also like to thank, again, everyone that has contributed so far. I am not really doing any code that could be useful for the project as a whole, but both in this thread and the one I linked there is a lot of support to achieve a solution, and this is both very heartwarming and a great show of what a great community looks like. It’s been a little over a year of my serious TiddlyWiki usage and I’m very, very happy with it. So thanks for that!)
EDIT: I went a bit further in my inquiries. I realise there are two rendering moments at play here: the first is when the -render
command is used to generate the static files; this generates, say, the my%20%spaced%20tiddler%20title.html
. However, if “My Spaced Tiddler Title” has further links in its body, then tv-wikilink-template
comes into play to generate the href
tags necessary for the .html
body of the rendered tiddler. So, ideally, I would override both.
For the -render
, I think it suffices to use the filename-filter
option when rendering, so that is okay - and I would suppose it solved my goal, had I not realised I need to handle linked tiddlers for each rendered tiddler. As for the rest, I’ll try to figure something out that would not be too intrusive with the core modules.
EDIT2: I managed the -render
command; that was quite easy. I am now looking into tv-filter-export-link, which should do the rest for me!
EDIT3: yep - I solved it! this was really not so hard and in fact there is barely any core interventions to do.
for future readers, I am creating the slugs outside of Tiddlywiki (I suppose it would not be hard to implement it in JS to run inside the wiki, but my deployment routine is external; anyway — ) and then retrieve slugs both in the -render
command and in a custom template for rendering, via the tv-filter-export-link
; since it receives the title of the current tiddler as input, all it takes is to add the [get[slug]]
filter and any further prefix and suffix needed.
So this is done. Nice! Thanks to everyone!