We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I added another Var to exclude folders from the Sitemap, for example: slider, home-parts, search And added the <lastmod> Attribute.
<lastmod>
class Pico_Sitemap { private $is_sitemap; private $exclude;
public function __construct(){ $this->is_sitemap = false; $this->exclude = array('home', 'slider', 'suche'); }
public function get_pages(&$pages, &$current_page, &$prev_page, &$next_page) { if($this->is_sitemap) { global $config; header($_SERVER['SERVER_PROTOCOL'].' 200 OK'); header('Content-Type: application/xml; charset=UTF-8'); $xml = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; foreach( $pages as $page ) { preg_match('/\/('.implode('|', $this->exclude).')\//', $page['url'].'/', $matches); if(empty($matches)) { $index = ''; $date = ''; $path = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'content'.DIRECTORY_SEPARATOR.str_ireplace($config['base_url'], '', $page['url']); if(is_dir($path)) { $index = 'index'; } $file = realpath($path.$index.'.md'); if(file_exists($file)) { $date = date ("Y-m-d", filemtime($file)); } $xml .= '<url><loc>'.$page['url'].'</loc><lastmod>'.$date.'</lastmod></url>'; } } $xml .= '</urlset>'; header('Content-Type: text/xml'); die($xml); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I added another Var to exclude folders from the Sitemap, for example: slider, home-parts, search
And added the
<lastmod>
Attribute.The text was updated successfully, but these errors were encountered: