Plugin

Archived
Forum
(read-only)

Rein de Vries does not actively monitor this forum
(but you can still get help from other EE users).


For official support, visit the official support site »

Google Sitemap Lite

ExpressionEngine 2, ExpressionEngine 3

Back to this add-on's main page
View Other Add-ons From Rein de Vries

     

You must be logged in to post.

Closed Entries

General

Blis Web Agency
Blis Web Agency

Hi Rein,

You may already be across this one but I noticed that you’re not checking the Status of an entry before it’s included in the sitemap. For example this code:

{exp:google_sitemap_lite:generate type=“structure” mode=“all” hide_from_nav=“yes”}

Produces a list of all Structure Pages and Entries regardless of whether they are opened or closed.

I had a look at a work around for this one and came up with some thing like this:

//Get last segment in URL
     
$bits explode("/"$val['url']);
     
$lastbit end($bits);
     
$status "open";

     
//Find It
     
$results $this->EE->db->get_where('structure_listings', array('uri' => $lastbit));
     if(
$results->num_rows() > )
     
{
      
if ($results->num_rows() == 1)
      
{

       
foreach($results->result() as $result)
       
{
        
//set the table
        
$entry_id $result->entry_id;
                    
       
}

      } 
else {
       
//As there should never be more than 1, set to open...
       
$status "open";
      
}

      
     }


     $results 
$this->EE->db->get_where('channel_titles', array('entry_id' => $entry_id));
     
     
//Default to Open     
     
if($results->num_rows() > )
     
{
      
foreach($results->result() as $result)
      
{
       
//set the table
       
$status $result->status;
                   
      
}
     }     

     
if ($status == 'closed')
     
{
      
continue;
     

It’s pretty hacky but is getting the job done.

Any chance of adapting something like this into a future build?

Cheers,

Sam

Reinos
# 1
Developer
Reinos

Hi Sam,

I opensourced the project on Github. You can make there a pull request ;-)

https://github.com/reinos/ee_google_sitemap_lite

Best,
Rein

Blis Web Agency
# 2
Blis Web Agency

Good thing. Thanks Rein.