Blog /django-cool-urls

May 30, 2024 04:27 +0000  |  Django Python 0

It's taken the better part of six months, working a few hours in the evenings when I can scratch the time together, but my latest project is finally finished.

Named for the famous Tim Berners-Lee quote, django-cool-urls is a little library that lets you link to a web page or embedded video from your site, and should that link ever die (the site removed the page, or just died altogether, etc.) your site will swap out the external link for a local copy.

Just swap out this:

<a href="">...</a>

for this:

<a href="{% cool_url '' %}">...</a>

I hear this sort of thing is great for SEO, but I mostly wrote it 'cause I was tired of going over old blog posts that linked to things that no longer exist, leaving a post stripped of context.

So, after hacking something together to work inside my site, I broke it out into a proper Django module mostly 'cause I thought it might be useful to others... well that and I like to build pretty things, and this code is very pretty.

Anyway, it's all up there now, GPL-licensed for the world to use or ignore. Check it out if you're so inclined:


Post a Comment

Markdown will work here, if you're into that sort of thing.