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

Assigned to
a month ago
a month ago
No labels applied.

~acegiak a 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 a 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 a month ago

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

~acegiak a 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 a 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 a month ago

yeah that all makes perfect sense to me

~tsileo a 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.