Module

Developer
Supported

Sitemap Module

ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5

Back to this add-on's main page
View Other Add-ons From PutYourLightsOn

     

You must be logged in to post.

Structure Support [resolved]

Support Request

Reusser Design
Reusser Design

I’d like to see Structure support built into this. It looks like {url_title} is accepted by Sitemap, but Structure pages could have a url structure entirely different than the {url_title}.

PutYourLightsOn
# 1
Developer
PutYourLightsOn

this is already under consideration for a future release, thanks for the feature request!

jayrobinson
# 2
jayrobinson

I’d also like to see this implemented. Thanks!

Karen
# 3
Karen

We implemented this by adding the following code to mod.sitemap.php:

Just inside the settings if statement which starts on line 109/110 we added this:

// check if this is a structure page channel
 
$channel_type "none";
 
$this->EE->db->select('type');
 
$this->EE->db->where('site_id'$this->EE->config->item('site_id'));
 
$this->EE->db->where('channel_id'$channel_id);
 
$this->EE->db->limit(1);
 
$query $this->EE->db->get('exp_structure_channels');
 
$channel_type $query->row('type');

 
// if this is a structure page channel, get the pages in an array
 
if ($channel_type == "page")
 
{
  $this
->EE->db->select('site_pages');
  
$this->EE->db->where('site_id'$this->EE->config->item('site_id'));
  
$this->EE->db->limit(1);
  
$query $this->EE->db->get('exp_sites');
  
$site_pages unserialize(base64_decode($query->row('site_pages')));
  
$site_pages $site_pages[$this->EE->config->item('site_id')]['uris'];
 

Then, just inside the ‘check offset and limit’ if statement which starts on line 145/146 we added this:

// create structure_url if this is a structure page channel
   
if ($channel_type == "page")
   
{
    $entry
->structure_url $site_pages[$entry->entry_id];
   

What this does is add a {structure_url} variable to the plugin.  Then, you should go to the Sitemap screen and set the URL of any Page Channel to “http://www.yourdomain.com{structure_url}”.  Note the lack of a slash between the domain and the variable - that’s intentional, as the Structure URLs all start with slash.

The usual disclaimer applies here - we are using this code, but it may not work for your system.  We may have made bad assumptions.  This may appear to be a good solution but may actually be flawed.  We may have broken everything forever, and if you use this code you may break everything forever as well.  But it’s working for me :)

PutYourLightsOn
# 4
Developer
PutYourLightsOn

we just released version 2.4 which supports Structure with the {page_uri} and {page_url} tags