Typo gets dynamic permalink URL

If you’ve been following our commits on Github, you must now know that, despite being quite silent here, we’ve been working hard on your favourite Rails application. Typo 5.2.1 is on its way, and even though it’s now too late to submit requests for enhancement, you can still submit bugs, and we’ll try to fix them as much as possible. You can also ask for features and improvements, but they won’t be in our next release, unless you submit a patch with tests.

Cyril has recently been working on a separate branch, to develop Typo 5.2.1 main feature: dynamic permalink URLs for posts. This is a great improvement and a great work he can really be proud of. Permalink URL were almost hard coded in typo, forcing people to use the /date/month/year/permalink scheme. You can now define your permalinks in the SEO part of your Typo install, using some reserved keywords:

  • %year%: year.
  • %month%: month.
  • %day%: day.
  • %title%: post slug

This gives fancy things like :

  • /%year%/%month%/%day%/%title% is the default option, and will generate /date/month/year/permalink.
  • /foo/%year%/bar/%day%/joker/%month%/hiphop/%title% will generate /foo/year/bar/day/joker/month/hiphop/permalink. I know, this is totally useless, but it works.
  • /%title%.html will generate /permalink.html URL.
  • And so on…

Will this break something?

Absolutely, this will break your existing theme an horrible way if you’ve been using an heavily tweaked one. Check in your themes for the /views/ directory. If you find something there, it must be brocken. Otherwise, it may still work fine.

So, what do I need to change?

Not much actually.

  • In articles/_comment_box.html.erb use @article.comment_url instead of comments_path(@article)

  • all link preview_new_comment_path(@article) are change to @article.preview_comment_url

  • all link url_for formatted_article_path(@article, :rss) are change to @article.feed_url(:rss)

  • all link formatted_article_url(@article, @format) are change to @article.permalink_by_format(@format)

That’s all folks, see you soon on #typo, we always enjoy newcommers and feedback.

Thu, 19 Feb 2009 19:56 Posted in

Tags ,

  1. Avatar

    By Nicolas Laplante about 1 hour later:


    Great news!

    I’ll have to fix my theme but that will be something to look forward to in the 5.2.1 release.

    As always, keep up the good work! Typo is very nice.

  2. Avatar

    By yannick about 1 hour later:


    Great !

  3. Avatar

    By Tobias Weisserth 2 days later:


    Great job everybody. I’ve been really busy at work so I haven’t had time to “play with Typo” recently, but I’m at it right now, testing my current git checkout from github.

Comment Typo gets dynamic permalink URL


RSS