kjvarga / sitemap_generator

SitemapGenerator is a framework-agnostic XML Sitemap generator written in Ruby with automatic Rails integration. It supports Video, News, Image, Mobile, PageMap and Alternate Links sitemap extensions and includes Rake tasks for managing your sitemaps, as well as many other great features.
MIT License
2.44k stars 276 forks source link

How to remove default priority, lastmod and changefreq from all urls #395

Closed Itallohsa closed 2 years ago

Itallohsa commented 2 years ago

I'm basically having the same problem as mentioned in other issues. Adding nil value in add config solves part of the problem, Remove lastmod, changefreq and priority from urls but still generate on first link (default_host).

Code:

SitemapGenerator::Sitemap.default_host = "http://localhost:8080/" SitemapGenerator::Sitemap.compress = false

SitemapGenerator::Sitemap.create do add "/login", changefreq: nil, priority: nil, lastmod: nil

Result:

url loc > http://localhost:8080/ </loc lastmod> 2022-03-10T13:13:11-03:00 </lastmod changefreq> weekly </changefreq priority> 1.0 </priority /url url loc> http://localhost:8080/login </loc /url

kjvarga commented 2 years ago

Please see the include_root option in https://github.com/kjvarga/sitemap_generator#sitemap-options

You'll want to turn that off and then add the root url manually via `add('/', ...your options here).