~tsileo/microblog.pub#47: 
Add article title slug url endpoint

Example: for article titled "this is my example" I should be able to access that article by a human readable URL such as mysite.com/article/this-is-my-example

Status
REPORTED
Submitter
~acegiak
Assigned to
No-one
Submitted
1 year, 1 month ago
Updated
1 year, 1 month ago
Labels
No labels applied.

~acegiak 1 year, 1 month ago

I spent several hours trying to implement this myself but I can't work out how to query Json values properly in this environment 😅

~tsileo 1 year, 1 month ago

Hey, so here is my take on this:

I want notes and articles to have the same ID/URL, and it's hard to make a meaningful slug for notes.

But, I agree that for articles it would make sense, what about having the URL for article to be: /o/{uuid}/{slug}?

~acegiak 1 year, 1 month ago

That makes sense. It's just such a long uuid though, makes for an ugly looking URL

~acegiak 1 year, 1 month ago

My plan was to make an additional alternate endpoint so that /o/{uuid} would still work but /article/{slug} would be another option for humans

~tsileo 1 year, 1 month ago*

Ok I see your point.

I like the idea of having at least a part of the ID to prevent having to handle duplicate slug.

Would having /articles/{id[:7]}/{slug} be a reasonable compromise to you?

I think a good plan could be:

  • add a new slug field + migration to backfill it for existing article
  • allow the UI to provide a slug (optional), will default to the "slugified" title
  • setup a 301 redirect when /o/{uuid} is requested with HTML to /articles/{uuid[:7]}/{slug}

Later on, I think we could allow notes to have a slug too and have a /notes/... URL to for the HTML version.

i will try to start tacking this now.

~acegiak 1 year, 1 month ago

yeah that all makes perfect sense to me

~tsileo 1 year, 1 month ago*

I just pushed a first update that implements most of it, the only thing missing is the custom slug, I will push that later.

Register here or Log in to comment, or comment via email.