tristangoossens / php-sitemap-generator Goto Github PK
View Code? Open in Web Editor NEWPHP script for generating a XML sitemap for your website
PHP script for generating a XML sitemap for your website
I would argue that links containing the "mailto" and "tel" protocols should not be included in the sitemap. I had an email link show in my sitemap because it included the website domain in the address (whereas the GMail address was not included, because external links were not being crawled). A reference explaining this type of link: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
For example, a crawl of the "www.examplesite.com" website which contains a "mailto" link using the "[email protected]" address, would have an entry like this in the sitemap:
http://www.examplesite.com/mailto:[email protected]
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
generate multi XML files when links more than 50,000
If the URLs in the anchor tag are starting with //www.example.com or such it makes the URL entry into the sitemap as https://www.example.com//example.com/page
I had this error when i tried to generate the sitemap : $dom->loadXML($xml); EntityRef: expecting ';' at line 163
so i add this code, and now it's working well
$xml = str_replace('&', '&', $xml);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.