Multiple sites organizing page_layouts

61 views
Skip to first unread message

PeterB

unread,
Feb 8, 2016, 4:47:14 AM2/8/16
to Alchemy CMS

Hi guys, is it possible to have nested folders in page_layouts folder to separate different sites?
If not, how do you normally organize your templates for multiple sites?

page_layouts (folder)

  • site1/_index.html.erb
  • site2/_index.html.erb

page_layouts.yml

name: 'site1/index'
elements [article]


>Thomas mentioned

>There is a not very well documented (sorry!) feature called sites.yml. This offers exactly what you described.


Sorry but I cannot find any note about sites.yml it in the source code.

Robin Böning

unread,
Feb 8, 2016, 4:53:06 AM2/8/16
to alche...@googlegroups.com
Not tested, but I think this is not possible.

Do you have hundreds of page_layouts or why not just naming them like “site1_home”, “site2_home”?

Btw: If you don’t have any differences between page_layouts you can just use the same page_layout for different sites.

Hope that helps,

Robin


--
You received this message because you are subscribed to the Google Groups "Alchemy CMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alchemy-cms...@googlegroups.com.
To post to this group, send email to alche...@googlegroups.com.
Visit this group at https://groups.google.com/group/alchemy-cms.
To view this discussion on the web visit https://groups.google.com/d/msgid/alchemy-cms/0485a978-35be-4ca9-bb51-8991674029ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Petr Blahutka

unread,
Feb 8, 2016, 5:30:27 AM2/8/16
to alche...@googlegroups.com
I have only 3 sites, but I want to be sure I always edit right file for the site.

I try to use before filter in application_controller.rb somthing like and setup new view folder for the site

def set_paths
host = current_alchemy_site.host
prepend_view_path(File.join(Rails.root, "themes/#{host}/views"))
end


--
You received this message because you are subscribed to a topic in the Google Groups "Alchemy CMS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/alchemy-cms/Q8ZJLWrLoLA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to alchemy-cms...@googlegroups.com.

To post to this group, send email to alche...@googlegroups.com.
Visit this group at https://groups.google.com/group/alchemy-cms.

For more options, visit https://groups.google.com/d/optout.



--
S pozdravem/ Best Regards
Petr Blahutka
------------------------------
+420 776 012 930

Thomas von Deyen

unread,
Feb 8, 2016, 1:45:18 PM2/8/16
to alche...@googlegroups.com
We can't recommend to use before filters for this feature. 

## Use the site layouts feature:

Create a `config/alchemy/site_layouts.yml` file and put a site name and assign page layout names to them in order to only have a layout available for this site. 

```
- name: a_sites_name
  page_layouts: [layout1, layout2]

- name: another_sites_name
  page_layouts: [layout1, layout3]
```

Then create a partial for your site layout at: `app/views/alchemy/site_layouts/_a_sites_name.erb`

Here is the source code you were looking for:


I hope this helps

Best

Thomas
Reply all
Reply to author
Forward
0 new messages