Page ID extraction

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version:

Version 4.6
CWP 2.6

Question:

What’s the easiest way of extracting all the page IDs and the relevant URLs and Page Titles associated with the ID?

Ideally in a CSV file or something that I can use to map to a new navigation.

Are there any reports I can run?

// Include any relevant code. If you have a lot of code, link to a gist instead.

You can create a custom report, to use in the CMS. There is also an option to ‘Export as CSV’.

Save this file PageReport.php in your app/src folder:

<?php

use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Reports\Report;

class PageReport extends Report
{
    public function title()
    {
        return 'All pages';
    }
    
    public function sourceRecords($params = null)
    {
        return SiteTree::get();
    }
    
    public function columns()
    {
        return array(
          "ID"           => array(
            "title" => "ID",
            "link"  => true,
          ),
          "Title"        => array(
            "title" => "Title",
            "link"  => true,
          ),
          "AbsoluteLink" => array(
            "title" => "URL",
            "link"  => false,
          )
        
        );
    }
    
}