ikeikeikeike / go-sitemap-generator

go-sitemap-generator is the easiest way to generate Sitemaps in Go
https://github.com/ikeikeikeike/go-sitemap-generator
MIT License
220 stars 65 forks source link

How to create sitemap without "changefreq" or "priority" #34

Open rich-tweed opened 5 years ago

rich-tweed commented 5 years ago

When I create sitemaps using this repo is seems like "changefreq" and "priority" tags are being added, with default values of "weekly" and "0.5" respectively.

How can I unset them or create a sitemap without these tags?

eduardohoraciosanto commented 3 years ago

On the Sitemap Protocol Specification it is stated that these fields are optional.

In this library, the fields are being populated if they are not present at the moment the XML is created Inside github.com/ikeikeikeike/go-sitemap-generator/v2/stm/builder_url.go

       if _, ok := SetBuilderElementValue(url, su.data, "changefreq"); !ok {
        changefreq := url.CreateElement("changefreq")
        changefreq.SetText("weekly")
    }
    if _, ok := SetBuilderElementValue(url, su.data, "priority"); !ok {
        priority := url.CreateElement("priority")
        priority.SetText("0.5")
    }

Not really sure why this is the current behaviour.

There's a PR #33 that addresses this and has a few more resources showing that these fields could be ignored. Not sure how is the approval handled. @ikeikeikeike are you in charge of accepting the contributions? Just asking because the PR is from 2019 🤓

ammark100 commented 1 year ago

Hi @ikeikeikeike ,

Any updates on this one?