10

I want to change the root path of spree site to a static page.

Can anyone please tell how can I change the spree default home page?

Andrew
  • 11,894
  • 12
  • 69
  • 85
Nikhil Kathuria
  • 461
  • 6
  • 12

1 Answers1

6

One easy solution is : in your public directory you place the static index.html . Then in your routes.rb :

mount Spree::Core::Engine, :at => '/store'

with the idea to point a link from your index.html to yoursite.com/store .

R Milushev
  • 4,295
  • 3
  • 27
  • 35
  • do you have any idea about dynamic page also that can be placed at root path. – Nikhil Kathuria Feb 05 '13 at 13:37
  • 1
    Absolutely , the pattern is the same . You have a `store` route , which points your Spree engine mount point . Your Rials generated (dynamical) content might be a resource , which have `index` pointing to `root` of your app . Something like : `root :to => 'your_resource#index'` at the bottom of your `routes.rb`. Assuming that in your `index` template there is a link to store. – R Milushev Feb 05 '13 at 15:06
  • i have sessions controller : [class SessionsController < ApplicationController def home end end ] i want sessions/home at root page... i mention in routes : [root :to => 'sessions#home'],but its no working – Nikhil Kathuria Feb 06 '13 at 05:55
  • 1
    Why demolish the default rails behaviour? The spree::homecontroller#index action will render the spree/home/index.html.erb template file with or without layout without problem, just place the file there and it will render. It makes no sense to place a view inside the public folder when it doesn't have to be there. Bad answer in my opninion – Fabian de Pabian May 08 '15 at 11:53
  • Do you mind if you read the question and comments once again? – R Milushev May 08 '15 at 19:16
  • Messing with pages in 'public' is not quite 'rails way' – Outside_Box Oct 11 '16 at 10:13