![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Python3 package for writing large XML sitemaps with no external dependencies
Python3 package for writing large XML sitemaps with no external dependencies.
pip install xml-sitemap-writer
This package is meant to generate sitemaps with hundred of thousands of URLs in memory-efficient way by making use of iterators to populate sitemap with URLs.
from typing import Iterator
from xml_sitemap_writer import XMLSitemap
def get_products_for_sitemap() -> Iterator[str]:
"""
Replace the logic below with a query from your database.
"""
for idx in range(1, 1000001):
yield f"/product/{idx}.html" # URLs should be relative to what you provide as "root_url" below
with XMLSitemap(path='/your/web/root', root_url='https://your.site.io') as sitemap:
sitemap.add_section('products')
sitemap.add_urls(get_products_for_sitemap())
sitemap.xml
and sitemap-00N.xml.gz
files will be generated once this code runs:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- Powered by https://github.com/pigs-will-fly/py-xml-sitemap-writer -->
<!-- 100000 urls -->
<sitemap><loc>https://your.site.io/sitemap-products-001.xml.gz</loc></sitemap>
<sitemap><loc>https://your.site.io/sitemap-products-002.xml.gz</loc></sitemap>
...
</sitemapindex>
And gzipped sub-sitemaps with up to 15.000 URLs each:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://your.site.io/product/1.html</loc></url>
<url><loc>https://your.site.io/product/2.html</loc></url>
<url><loc>https://your.site.io/product/3.html</loc></url>
...
</urlset>
<!-- 15000 urls in the sitemap -->
For easier discovery of your sitemap add its URL to /robots.txt
file:
Sitemap: https://your.site.io/sitemap.xml
FAQs
Python3 package for writing large XML sitemaps with no external dependencies
We found that xml-sitemap-writer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.