Ignore AMP links in sitemap

I am trying to ignore custom outputs, in this case, AMP URLs. In my sitemap, I have the following code:

{{ range .Data.Pages }}
    {{ if not (isset .Params "url") }}
        ....
    {{ end }}
{{ end }}

The Data.Pages looks into all the pages, how should I ignore AMP pages?

Do you mean pages which have AMP as their only output format (or don’t have HTML as their format)? You can check for existence of HTML output format:

{{ range .Data.Pages }}
    {{ if .OutputFormats.Get "html" }}
        ...
    {{ end }}
{{ end }}

I don’t know of any convenience functions to filter them directly or with where pipeline.

From my experience, if you have both HTML and AMP as output formats, the sitemap shows link for the default one (not AMP), so you should have no problem with those.

I mean, ignoring all URLs like, for example, https://localhost:1313/amp/blog/* and keeping only `http://localhost1313/blog/*

Browsing https://gohugo.io/variables/page/#pages, I’d try .Site.RegularPages. If you share your’s project’s code someone will be able to help.

Sorry, here is the sitemap code -> https://github.com/akshaybabloo/gollahalli.com/blob/master/themes/Spark/layouts/sitemap.xml

Looks like a problem with permalinkable. I had to disable it with

[outputFormats]
 [outputFormats.AMP]
    permalinkable = false

Looks like a bug? Similar to https://github.com/gohugoio/hugo/issues/5849

Bug report submitted at https://github.com/gohugoio/hugo/issues/5910