Solid Hacks
  • Solid Hacks
  • Chapter 1 - Static Pages
    • Hosting a Web Page On Your Pod
    • Hosting a One Page Game
    • URL Shortening
    • Creating a Realtime Markdown Editor
    • Saving a Markdown Document to Your Pod
    • Hosting Snippets
  • Chapter 2 - Working With Pods
    • Solid from the Console
    • Solid from the Command Line
    • Creating Group URIs
    • Hosting a pod on your own domain with CNAME
    • Interacting With Crawlers
    • Logging in with a Public Key
  • Chapter 3 - Working With Panes
    • Creating a Personal Diary
    • Creating a Slideshow
    • Creating an Audio playlist
    • Create a Presentation From Text
  • Chapter 4 - Integrations
    • Integrating Solid with Mastodon
    • Integrating with IPFS
    • Integrating Solid with Facebook
    • Integrating with Amazon S3
    • Integrating With Jitsi
  • Appendices
    • Appendix A : Solid Resources
    • Appendix B : Solid Communities
    • Appendix C : Utilities
Powered by GitBook
On this page
  • Introduction
  • The Hack
  • See Also
  1. Chapter 1 - Static Pages

URL Shortening

PreviousHosting a One Page GameNextCreating a Realtime Markdown Editor

Last updated 6 years ago

Introduction

This hack enables you to use your solid pod as a URL shortener. There are many reasons you might do this in normal life, however in Solid it becomes even better. This is because many client side apps derive their content from the query string. This can be up to 100k big so is impractical to share.

The Hack

  1. Open source tab

  2. Create a new file xxx.html in a given directory

  3. Add the code

<script>location.href="<URL>"</script>

Now when you click on that file it will take you to the longer URL. And we're done!

Tip 1 The idea behind short urls is that urls should be as short as possible. So when thinking about a place to put your short urls, we could standardize around a directory with as few characters as possible. Possible places to put this would be

POD_ROOT/public/u/
POD_ROOT/u/

Perhaps u for URL shortener?

Tip 2 The shortener can also double as a URL redirector. This has lots of unexpected reuse, as we shall see later!

See Also

Wikipedia article :

https://en.wikipedia.org/wiki/URL_shortening