Combining Collections?

  • Hi,


    I'm working on a Perch Runway website that is likely to have a lot (a lot) of content added to over the next few years.


    I'm trying to figure out the best way to structure it and would welcome any input.


    There will be four main sections

    1. Blog
    2. Case Studies
    3. Publications
    4. Resources

    If this was a smaller website, I'd most likely use a single 'Collection' and use 'Categories' for each section.


    I like the idea of separating out the different types of content into individual 'Collections', hopefully this should make it easier to manage in the CMS. Plus give me the option to use a different post template for each 'Collection' if needed.


    Each 'Collection' will use two 'Category Sets', I intend to use the 'Category Sets' to filter the 'Collections'. This all seems fairly standard so far...


    One of the 'Category Sets' will be called 'Themes'. For example, one of the 'Themes' would be 'Mental health'


    In each 'Collection' there might be content categorised as 'Mental health', I'd like to display a 'Latest' page, which would list the newest content from all four 'Collections' categorised as 'Mental health'. This is very simple to do if all the content was in a single 'Collection'.


    Is it possible to combine content from multiple 'Collections' in this way? :/


    Code
    1. perch_collection('Blog', ['template' => 'blog-template.html','category' => perch_get('cat'),]);
    2. perch_collection('Case Studies', ['template' => 'case-template.html''category' => perch_get('cat'),,]);
    3. perch_collection('Publications', ['template' => 'pub-template.html','category' => perch_get('cat'),]);
    4. perch_collection('Resources', ['template' => 'resource-template.html','category' => perch_get('cat'),]);
  • You should be able to use an array of collections as the key.


    Code
    1. perch_collection([
    2.         'Blog',
    3.         'Case Studies',
    4.         'Publications',
    5.         ''Resources'
    6.     ], [
    7.     'template' => 'blog-template.html',
    8.     'category' => perch_get('cat'),
    9. ]);

    Although this might not work with MySQL 5.7 as standard, due to strict mode, though you should be able to update the settings as required