Custom permalink on a per-post basis? #34

Closed
dph01 opened this Issue May 29, 2012 · 4 comments

3 participants

@dph01

Hi,

I'm guessing this feature isn't already in there, but might be useful for others in the future.

I'm migrating my blog from Posterous to Ruhoh and I'd like to keep the same permalinks. Unfortunately, a couple of the permalinks that Posterous has created seem to be a bit random (like based on a truncated post title), so there's no way that I can configure a site wide permalink convention in Ruhoh that will cover all cases. I'm guessing I'll probably have to get the Ruhoh configuration as close to Posterous' as as possible and then setup redirects on my web-server for the rest (thankfully I've only got a few posts anyway)

How about having the option of setting a custom permalink an a per post basis, as and when required, that overrides the permalink that would otherwise be set by the site convention?

@plusjade
ruhoh member

I agree, another member here had the same troubles when migrating from WordPress. It's hard to get the URL's exactly alike so there needs to be more fine-grained control. I'll plan to add manual overrides on a per page basis. The more extensible approach though, would be the ability to overload the way the permalinks are generated in the first place. That way you can create a function that matches, exactly, your existing URL pattern.

@plusjade plusjade added a commit that closed this issue May 31, 2012
@plusjade plusjade Add fixes for post permalink generation:
Supports international characters via unicode regular expressions.
Titles are always cast to string.
Strip dashes from start, end, and multi-dash occurences.
Category names are CGI escaped to support international characters.
Permalinks without tokens are now treated as literals.

Fixes #34 and #36
75a8a1e
@plusjade plusjade closed this in 75a8a1e May 31, 2012
@dph01

thanks for adding the feature - it's working well!

@mudasobwa

Since using :permalink in every post is a little bit annoying, I would ask if it’s possible to provide some custom metadata field (e. g. :id) and then use it in config.yml’s permalink section as shown:

posts:
  sort: ["date", "desc"]
  permalink: "/post/show/:id"

It might be more clear for users. BTW, should not all the metadata fields be propagated to config.yml and vise versa?

Thanks in advance.

@plusjade
ruhoh member

@mudasobwa good idea, I've implemented it here: f5a9f78

All metadata is now accessible in the permalink but be careful with :id as it's a reserved attribute so you wouldn't be able to define it in the metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment