Good Practice to Show a Url

When create links/bookmarks/sources in Tiddlywiki I got used to paste the url address from browser address bar into a tiddler text (body) or field. In many cases this results in an ugly link!
One way is to use a title like [[title|url]] but sometimes it is not possible! for example you like to see the domain through a viewtemplate.

I developed a small macro to show a selected part of url automatically

\define url(address, n:3)
<a href=<<__address__>> target=_blank>
<$text text={{{[<__address__>split[/]first[$n$]join[/]]}}}/>
</a>
\end

Examples

<<url "https://libguides.merrimack.edu/research_help/Sources">>

<<url "https://www.google.com/search?q=database+types+of+source+article+book+report+thesis&oq=database+types+of+source+article+book+report+thesis&aqs=chrome..69i57j33i160l4.55962j0j7&sourceid=chrome&ie=UTF-8">>

results in


https://libguides.merrimack.edu

https://www.google.com

To give a try go to https://tiddlywiki.com, create a tiddler and paste the above codes.

What do you use and how do you address this problem? Share your thoughts and experiences!

Nice example. Moved it to Tips & Tricks

Nice. One may consider adding e.g three dots (…) to the displayed link so that it is clear that it leads to a subpart.

1 Like

yes, kind of short url!