Forum

Thread tagged as: Question

XML Sitemap

Hello,

What would you suggest is the best way to add the following to the sitemap?

I can think of a couple ways, just wanted to see what you think the best way is

  • Apps such as Blog & Events
  • List & Detail Pages

I've read the solution you have which says use

perch_pages_navigation(array(
        'template'=>'sitemap.html',
        'flat'=>true
    ));

But obviously that does not include any of the above

Dexter Harrison

Dexter Harrison 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

On our site, we do this:

<?php
    header('Content-type: application/xml');
    include('perch/runtime.php');
    echo '<?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">';
    perch_pages_navigation([
        'template' => 'sitemap.html',
        'flat' => true,
        'hide-extensions' => true
    ]);

    perch_blog_custom([
        'template' => 'google_sitemap.html',
        'paging'   => false,
        'count'    => 3000,
    ]);

    echo '</urlset>';

Perfect, thank you