how to change the Spree default home page?
Asked Answered
D

1

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?

Denizen answered 5/2, 2013 at 9:51 Comment(4)
Could it be : public/index.html?Pacifically
yes it can be: public/index.html or it can be any other static page.Denizen
try using it spree_static_contentIntosh
Really better idea , @anonymousxxx. Probably a good answer too :)Pacifically
P
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 .

Pacifically answered 5/2, 2013 at 11:40 Comment(6)
do you have any idea about dynamic page also that can be placed at root path.Denizen
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.Pacifically
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 workingDenizen
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 opninionFootstep
Do you mind if you read the question and comments once again?Pacifically
Messing with pages in 'public' is not quite 'rails way'Relieve

© 2022 - 2024 — McMap. All rights reserved.