[tw5] URL Import Gadget (URL to WikiText external link)

Please find attached in this post the JSON file you need to download and drag into any TiddlyWiki to add this gadget.

TW_UrlImportGadget.json (1.22 KB)

5 Likes

I use a bookmarklet that copies the wikitext link to the clipboard:

javascript: navigator.clipboard.writeText(`[[${document.title.replaceAll('|','–')}|${document.location.href}]]`);

I have no idea how your bookmarklet helps to create a WikiText link (in TiddlyWiki) to an external site.

Could you clarify?

When you click it in the bookmarks bar, it copies a wikitext link created from the current page title and URL. Then you can paste it into the tiddler like any other text.

Click (on what, I’m not sure) to copy and then paste is a great option for those who cannot drag and drop.

Drag and drop makes me much happier.

Bookmarklet - Wikipedia

Personally, I prefer [[URL Import Gadget (URL to WikiText external link)|https://groups.google.com/g/TiddlyWiki/c/q3A8j3sIXjI]] over [[q3A8j3sIXjI|https://groups.google.com/g/TiddlyWiki/c/q3A8j3sIXjI]].

Why on earth would you have not provided that crucial observation in your first post? I only tested with links that do not have gibberish in the URL.

I just wasted the last hour trying to get that bookmarklet to work.

If you recommend this as a good way to go, could you give some pointers on how to get it working?

To create the bookmarklet:

(note: these instructions are for Chrome. Similar actions are available for other browsers, though the menu item and dialog may vary somewhat)

  • First, select and copy the code posted by cskrisz to your clipboard:

    javascript: navigator.clipboard.writeText(`[[${document.title.replaceAll('|','–')}|${document.location.href}]]`);
    
  • Then, right-click on your browser’s bookmark bar and select “Add page…” from the popup menu.

  • In the dialog that appears, in the “Name” input, enter something like “Make a TW prettylink”, and in the “URL” input, paste the “javascript:…” code from your clipboard.

  • Press “Save” to add the bookmark to your browser.

  • Note that the new bookmark will appear at the end of your existing bookmarks. You can use drag-and-drop or “Bookmark manager” to relocate the bookmark within the bookmark bar
    To use the bookmarklet:

  • Go to any page on any website you like

  • Press the “Make a TW prettylink” bookmark

  • This will copy the current URL’s title and href to your system clipboard, formatted as a TW prettylink (e.g., [[Title|URL]])
    To add the prettylink to your TW document:

  • Open your TW document

  • Press “+” to create a new tiddler (or edit an existing tiddler)

  • Place the cursor in the tiddler’s text area input

  • Press ctrl-V or right-click and select “Paste” from the popup menu.
    done.

2 Likes

Thanks Eric, I had everything working, but had no clue how to use it.

Having to navigate to the site is okay, but that’s a completely different use case than the one in the OP, which is about grabbing links on a page.

Well, mine was about grabbing links that don’t have gibberish in them.