gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 122 forks source link

Specify feed url in config file #97

Closed chadoh closed 12 years ago

chadoh commented 12 years ago

I think that it's maybe a good idea to allow people to specify the feed_url in the config file, so that @feed_url can be used in the feed.haml file. That way, if I want to set up a Feedburner (or some such) from my /articles.xml feed, there's a simple and central and consistent way to do that.

I fear that this may add more load time than it's worth, though, since simply updating feed.haml is very easy. Let me know what you think.

gma commented 12 years ago

Interesting; it hadn't occurred to me to configure it.

I've got this in my config.ru file:

use Rack::Rewrite do
  r301 %r{/articles.xml(\?.*)?}, 'http://feeds.feedburner.com/effectif-development', :if => Proc.new { |rack_env|
    rack_env['HTTP_USER_AGENT'] !~ /FeedBurner/
  }
end

I'll mull it over a bit; it clearly isn't obvious that you can use Rack::Rewrite for this, but I'm wondering if I should write it up or merge your patch. There's a trade off between simplicity in the UI and a little bit more complexity in the code…

chadoh commented 12 years ago

That's an interesting approach. I also thought it might be possible to just assume a feedburner URL, like

'http://feeds.feedburner.com#{@title.downcase.parameterize}'

But that still leaves open the issue of how to allow nesta user's to override it and specify a custom feed address.

Again, I'm not sure if it's a problem worth solving. It's really easy to just edit feed.haml.

gma commented 12 years ago

I'm coming down in favour of your "just edit feed.haml" suggestion. The more things that get into that config file, the more crufty it's going to look a year from now…

chadoh commented 12 years ago

Good plan. I'll switch chadoh.com from using this soon and switch back to the main gem.

Thanks!