diff --git a/src/actions/articles/show.cr b/src/actions/articles/show.cr index 867a84a..35a66f7 100644 --- a/src/actions/articles/show.cr +++ b/src/actions/articles/show.cr @@ -1,7 +1,17 @@ require "json" class Articles::Show < BrowserAction - get "/posts/:post_id" do + get "/posts/:post_slug" do + id_match = post_slug.match(/([0-9a-f]{12})$/i) + if id_match + post_id = id_match[1] + else + return html( + Errors::ShowPage, + message: "Error parsing the URL", + status: 500, + ) + end if Lucky::Env.use_local? response = LocalClient.post_data(post_id) else