0

I need to set the page layout, currently, I can see that the used page layout file is application.html.haml

how would I let the page use another file as the layout? I thought it would be possible by using page_layouts.yml by setting the name but it seems I still missing how to do it. What does that name relates to? for now, its value is index but where is that index file?

Any idea?

EDIT

I could handle this but only worked at show page as:

class ApplicationController < ActionController::Base
  layout :determine_layout

 def determine_layout
    module_name = self.class.to_s.split("::").first
    return (module_name.eql?("Alchemy") ? "pages" : "application")
  end

However, I still need to apply this while editing the page at admin page.

simo
  • 23,342
  • 38
  • 121
  • 218

1 Answers1

0

The application.html.erb file is the template for the whole Rails application. Alchemy pages have their own templates per page_layout stored in the app/views/alchemy/page_layouts folder.

Please read the guideline on how to create a page layouts and templates

https://guides.alchemy-cms.com/pages.html#page-templates

EDIT:

You are able to set the layout used in the admin page edit preview with the admin_page_preview_layout setting in the config/alchemy/config.yml.

https://github.com/AlchemyCMS/alchemy_cms/blob/main/config/alchemy/config.yml#L205

tvdeyen
  • 723
  • 4
  • 9
  • Thank you @tvdeyen , but how would I use another main template than `application.html.erb` ? which Alchemy controller shall I customize? – simo Dec 31 '21 at 17:08
  • It seems I need to set `layout` at `PagesController` but I am not sure about the proper approach.. I need to not to use the main template `application.html.erb` for the CMS pages – simo Dec 31 '21 at 17:29
  • kindly check EDIT above – simo Jan 01 '22 at 06:44
  • Thank you! I wish this is configured more dynamically though. – simo Jan 01 '22 at 13:43