PHP code example of jukra00 / kirby-sitemap

1. Go to this page and download the library: Download jukra00/kirby-sitemap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jukra00 / kirby-sitemap example snippets


<?= snippet('sitemap'); 

# config.php
return [
  'jukra00.kirby-sitemap' => [
    'ignore_ids' => function () {
      # Get all published pages with meta_robots fields value 'noindex'
      $ignoredPages = site()->pages()->published()->index()->filterBy('meta_robots', 'noindex');
      # Return array of ids
      return $ignoredPages->pluck('id');
    }
  ]
]