Coming in Markata 0.9.1 is far better documentation. i.e. Documentation that actually exists for everything. As part of poking around I realized that I often go to look up the docs for a plugin and forget that the path is /markta/plugins/feeds, sometimes I might try /markata/feeds or /plugins/feeds.py or /feeds or I might even forget the plugin name exactly and try something like feed and get a 404. So I added a didyoumean plugin to markata that takes care of this.

Happy Path

direct forward

If you have one post called /markata/plugins/feeds, and it is the only post called feeds, any combination of /markata/feeds or /plugins/feeds or /feeds will all automatically redirect with an html page (not a server 3xx) to the /markata/plugins/feeds post.

Here is the snippet that does the redirect.


<div class="container mx-auto px-4 py-8">
    <h1 class="text-2xl font-bold mb-4">Redirecting...</h1>
    <p class="mb-4">You will be redirected to <a href="/markata/plugins/feeds" class="text-blue-500 hover:underline">/markata/plugins/feeds</a></p>
    <script>window.location.href = "/markata/plugins/feeds";</script>
</div>

You won't see it unless you are on a really bad network, or you have js disabled, but this is what it would look like if you ever saw it. Notice there is a backup link if you have js disabled.

image

Multiple Similar Posts

list of options

If you have multiple posts called didyoumean from different directories, in the video I made a clashing post at /markata/cli/didyoumean with /markata/plugins/didyoumean. If you go to /didyoumean it will notice that there are multiple options and present you with a list of all of the potential pages that match.

image

Finally No Matches

404.html

Last ditch effort is to implement a 404 page. This page will know all of the possible paths in your project and give you a list of all the similar pages more like a traditional didyoumean plugin.

image