Thread tagged as: Question

sitemap with collections

I have a sitemap displaying (screenshot below)

My code is the following using the default item.html template

    'from-path' => '/'.REGION,
    'include-hidden' => true

My question is, from the screenshot above how would I go about adding my product collections under the products link of each segment?

My collections are displayed like this

perch_collection('foodservice '.REGION, [ 'template' => 'products/_sitemap_products.html' ]); perch_collection('Building Care '.REGION, [ 'template' => 'products/_sitemap_products.html' ]); perch_collection('Industry '.REGION, [ 'template' => 'products/_sitemap_products.html' ]); perch_collection('Health Care '.REGION, [ 'template' => 'products/_sitemap_products.html' ]); perch_collection('Automotive '.REGION, [ 'template' => 'products/_sitemap_products.html' ]); perch_collection('Aerospace '.REGION, [ 'template' => 'products/_sitemap_products.html' ]);
  • side note - I have created separate collections due to the fact each segment has a different set of filter configurations (See screenshot)

Link here -

Would this be even possible?

Fishtank Creative

Fishtank Creative 2 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Pass the result into the template:

PerchSystem::set_var('foodservice', perch_collection('foodservice '.REGION, [
    'template' => 'products/_sitemap_products.html'
], true));

and then in your template, output it wherever you want:

<perch:if id="pagePath" value="/products/or/whatever">
     <perch:pages id="foodservice" encode="false" />