I already made some successfully experiments integrating nesta with rails 3 (see Is it possble include Nesta CMS into Rails3 application? and Nesta CMS and Rails3 integration: adding blog to an exiting rails 3 application)
But than, I needed a menu on the right side of the blog, like explained in "Working with menus"
To give it a try, I built the famous content-demo site with nesta demo:content
, but all links appearing on the right side, which are coming from content-demo/menu.txt, are broken because related to the main Rails app (http://example.com) and not to the embedded nesta blog (http://example.com/blog)
Here it is my current file configs, the integration is between Rails 3.0.10 and Nesta 0.9.10 :
config/routes.rb
match '/blog' => Nesta::App
match '/css/*style.css' => Nesta::App
match '/attachments/*file' => Nesta::App
root :to => "home#index"
UPDATE:
using mount Nesta::App, :at => '/blog'
instead of match '/blog' => Nesta::App
rich the same result ...
config/initializers/nesta.rb
require "nesta/env"
require "nesta/app"
Nesta::Env.root = ::File.expand_path("../../nesta-blog", File.dirname(__FILE__))
Nesta::App.root = ::File.expand_path("../../nesta-blog", File.dirname(__FILE__))
nesta-blog/config/config.yml
...
content: nesta-blog/content-demo
...
I thought was depending by how nesta built the relative path of menu's liks and that was depending on base_url
method in nesta-0.9.10/lib/nesta/app.rb
.
Than I tried unpacking locally nesta-0.9.10 changing url = "http://#{request.host}"
in url = "http://#{request.host}/blog"
:
def base_url
url = "http://#{request.host}/blog"
request.port == 80 ? url : url + ":#{request.port}"
end
put gem 'nesta', :path => 'vendor/gems/nesta-0.9.10'
on Gemfile and build update nesta
but no, doesn't work.
UPDATE:
Also few tries with Nesta::Menu.for_path('/')
in ./vendor/gems/nesta-0.9.10/lib/nesta/app.rb
def set_common_variables
@menu_items = Nesta::Menu.for_path('/')
@site_title = Nesta::Config.title
set_from_config(:title, :subtitle, :google_analytics_code)
@heading = @title
end
didn't get results.
My nesta-blog/content-demo/menu.txt don't currently refers to the home page (like in default generation with nesta demo:content
):
marking-up-pages
examples/using-markdown
examples/using-textile
examples/using-haml
adding-attachments
menu-editing
publishing-a-feed
and if I try putting on top something like :
/
or /blog
or /nesta-blog
the menu disappear ...
So my question is, how does it work ? Do you have any suggestion / workaround ?
Thanks in advance Luca G. Soave