I’m a big proponent of using pretty urls in websites, so when I started making Solid Apps I used them out of habit. But recently I’ve been having some discussions and I think it’s a topic worth discussing.
Imagine that you store recipes in your POD, and you’re using an app to browse them. If you have a recipe called “Pizza”, when you open it in the app the url could be something like https://my-app.com/recipes/pizza
.
Similarly:
-
https://my-app.com/recipes/pizza/edit
could allow you to edit the recipe. -
https://my-app.com/recipes/create
could allow you to create a new recipe. -
https://my-app.com/recipes
could show all your recipes. - etc.
And that’s how I’ve been doing it thus far. However, when it comes to Solid, we have some problems with this.
For example, what does the url https://my-app.com/recipes/pizza
mean? If you’re logged in, that’s the “Pizza” recipe in your POD. But what if you’re not logged in? Also, if you copy&paste the url and send it to someone, they will see a very different page. If they’re logged out, they’ll get a 404. And if they’re logged in, they’ll see a different recipe.
The way I’ve been resolving this is having a separate page for sharing, which I call “the viewer”. So if you were to share your recipe, this is the actual url you’d be sending someone else: https://my-app.com/viewer?url=https://my-pod.com/cookbook/pizza#it
.
In terms of architecture, this is a lot better. And it makes me wonder if I should make my entire app like this, thus removing the idea of a viewer altogether. But I’m still not convinced that this is the way to go, because I can see some drawbacks to this type of url:
- It’s too long, and not easy to remember.
- The most meaningful part is on the query string, which may be removed by some software.
- Sending a url in the query string means you need to take special care with encoding special characters.
- I don’t like it >.<.
And yet, I cannot come up with a better solution :/. But I’m still hesitant to go into this direction, because I don’t think the UX is great. And this would make Solid Apps even more quirky for users.
One idea I’ve had is do something like https://my-app.com/recipes/{base64-encoded recipe url}
. Which solves some of the problems, but worsens others and introduces more (like obfuscating the recipe name).
So yeah, I’m torn on this and I’m not sure what the “best practice” should be. What do you think?