php-sitemap-generator
                                
                                 php-sitemap-generator copied to clipboard
                                
                                    php-sitemap-generator copied to clipboard
                            
                            
                            
                        Retrieve the modified date and populate de sitemap
I try to retrieve the <meta property="article:modified_time" content="" /> in my website to populate <lastmod> tag in the sitemap
In sitemap-generator.php, after :
libxml_use_internal_errors(true);
		$dom = new DOMDocument();
		@$dom->loadHTML($html);
I add this :
		$xp = new domxpath($dom);
			foreach ($xp->query("//meta[@property='article:modified_time']") as $el) {
				 $el->getAttribute("content");
			}
I'm a beginner in php, how can i add $el to the xml ? Also, i'd like to format the modified_time in Y-M-D thanks
I found a solution with php command get_meta_tags :
foreach ($pages as $page) {		
		 $tags = get_meta_tags($page);	
		 $tag = $tags['date'];  //We get the "meta name "date" content
$xml .= "<url><loc>" . $page . "</loc>
            <lastmod>" . $tag . "</lastmod> //We add the date content
            <changefreq>" . $this->config['CHANGE_FREQUENCY'] . "</changefreq>
            <priority>" . $this->config['PRIORITY'] . "</priority></url>";
		}