diff --git a/README.textile b/README.textile index 3cdd10847..89d8f93a2 100644 --- a/README.textile +++ b/README.textile @@ -38,6 +38,12 @@ Enki is a compact, easily extendable base for your blog. It does this by being h * If you're not using OpenID you're a chump * Hacking code is the easiest way to customize something +h2. URL path prefix + +Enki can run your blog with a URL path prefix. For example, you can run it at example.com/*blog* instead of blog.example.com. You can do so with the RAILS_RELATIVE_URL_ROOT environment variable, set either before starting the server or in config/application.rb before Enki::Application. Uncommenting this line in config/application.rb will enable this behavior in all environments: + +
ENV['RAILS_RELATIVE_URL_ROOT'] = '/blog'
+ h2. How it differs from Mephisto Mephisto is feature packed and quite customizable. It can however be daunting trying to find your way around the code, which isn’t so good if you’re trying to hack in your own features. Enki strips out a lot of the features that you probably don’t need (multiple authors and liquid templates, for example), and focuses on keeping a tight code base that is easy to comprehend and extend. diff --git a/app/helpers/url_helper.rb b/app/helpers/url_helper.rb index e251c093b..b6546e122 100644 --- a/app/helpers/url_helper.rb +++ b/app/helpers/url_helper.rb @@ -2,7 +2,7 @@ module UrlHelper def post_path(post, options = {}) suffix = options[:anchor] ? "##{options[:anchor]}" : "" path = post.published_at.strftime("/%Y/%m/%d/") + post.slug + suffix - path = "#{ENV['RAILS_RELATIVE_URL_ROOT']}#{path}" + path = "#{Rails.configuration.action_controller.relative_url_root}#{path}" path = URI.join(enki_config[:url], path) if options[:only_path] == false path end diff --git a/config.ru b/config.ru index cdc90fee9..a090842c2 100644 --- a/config.ru +++ b/config.ru @@ -2,6 +2,6 @@ require ::File.expand_path('../config/environment', __FILE__) -map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do +map Rails.configuration.action_controller.relative_url_root || "/" do run Enki::Application end