# Sitexml is broken

**URL:** <https://discourse.gohugo.io/t/sitexml-is-broken/36989>\
**Category:** support\
**Tags:** netlify\
**Created:** [February 5, 2022, 2:57am UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989 "2022-02-05T02:57:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![idomic](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idomic/32/15752_2.png) [@idomic](https://discourse.gohugo.io/u/idomic)\
**Post date:** [February 5, 2022, 2:57am UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/1 "2022-02-05T02:57:45Z")

</div>

Hi,

I did go over older posts, for some reason I can’t get the sitemap.xml to work on my page: [https://ploomber.io/sitemap.xml](https://ploomber.io/sitemap.xml)

I did configure the baseUrl as [https://ploomber.io/](https://ploomber.io/)

For some reason it still takes the base as /

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 5, 2022, 3:16am UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/2 "2022-02-05T03:16:19Z")

</div>

Well. Sample repo. What you have BEFORE hugo does use it to create a website.

I would have a look into the configuration. If you use a configuration directory you might have `_default` vs `production` issues. If you use TOML configuration you might configure your baseUrl at the wrong place and it’s not actually in the root config. If you are using a theme that theme might override the sitemap template. If… if… without seeing what you are doing the whole “it’s not working” becomes a comedy skit 🙂

---

<div class="post-metadata">

**Author:** ![idomic](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idomic/32/15752_2.png) [@idomic](https://discourse.gohugo.io/u/idomic)\
**Post date:** [February 5, 2022, 3:23am UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/3 "2022-02-05T03:23:02Z")

</div>

> [@davidsneighbour](#):
>
> ld have a look into the configuration. If you use a configuration directory you might have `_default` vs `production` is

Good point and thanks for the quick response, here’s my config.toml, sits within a \_default folder :

```auto

######################## default configuration ####################
baseURL = "https://ploomber.io/"
title = "Ploomber - Build data pipelines. FAST.⚡️"
theme = "andromeda-light"
# post pagination
paginate = "6"
# post excerpt
summaryLength = "10"
# google analytics
googleAnalytics = "G-3EBJ127JJP" # example: UA-123-45, for more info, read the article https://support.google.com/analytics/answer/1008080?hl=en
# disqus short name
disqusShortname = "ploomber" # get your shortname form here : https://disqus.com

############################# Modules ##############################
[module]
[module.hugoVersion]
extended = true
min = "0.83.1"

############################# Outputs ##############################
[outputs]
home = ["HTML", "RSS", "WebAppManifest"]

[imaging]
quality = 90

[caches]
[caches.images]
dir = ":resourceDir/_gen"
maxAge = "720h"

[caches.assets]
dir = ":resourceDir/_gen"
maxAge = "720h"

[markup]
[markup.goldmark.renderer]
[markup.tableOfContents]
    endLevel = 3
    ordered = false
    startLevel = 1
unsafe= true

[mediaTypes]
[mediaTypes."application/manifest+json"]
suffixes = ["webmanifest"]

[mediaTypes."text/netlify"]
delimiter = ""
suffixes = [""]

[outputFormats]
[outputFormats.WebAppManifest]
mediaType = "application/manifest+json"
rel = "manifest"

[sitemap]
filename = "sitemap.xml"
priority = 0.5

```

I’ve been using this template: [GitHub - gethugothemes/andromeda-light-hugo: Andromeda-light is a clean and modern Hugo SAAS Software theme. It perfectly fits any kind of SAAS Software. It is fully responsive, Superfast and powered by Bootstrap.](https://github.com/gethugothemes/andromeda-light)

---

<div class="post-metadata">

**Author:** ![idomic](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idomic/32/15752_2.png) [@idomic](https://discourse.gohugo.io/u/idomic)\
**Post date:** [February 5, 2022, 3:24am UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/4 "2022-02-05T03:24:13Z")

</div>

I’ve also tried just adding a custom template rn at default/sitemap.xml but it doesn’t seem to change anything:

```auto

{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">
  {{ range .Data.Pages }}
  {{ if not (or (hasPrefix .RelPermalink "/tags") (hasPrefix .RelPermalink "/categories")) }}
  <url>
    <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
    <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
    <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
    <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
    <xhtml:link
                rel="alternate"
                hreflang="{{ .Lang }}"
                href="{{ .Permalink }}"
                />{{ end }}
    <xhtml:link
                rel="alternate"
                hreflang="{{ .Lang }}"
                href="{{ .Permalink }}"
                />{{ end }}
  </url>
  {{ end }}
  {{ end }}
</urlset>
```

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 5, 2022, 6:21am UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/5 "2022-02-05T06:21:53Z")

</div>

> [@idomic](#):
>
> {{ .Permalink }}

That part looks like it will only use the path from your site root. If you have `baseURL` set you add `canonifyURLs=true` in the next line of your config and Hugo should add the full domain path.

Sidenote: Code in markdown (here in the discourse): use three backticks before code (```) then new line, then paste your code and end the whole thing with three more backticks. Then it becomes readable.

---

<div class="post-metadata">

**Author:** ![idomic](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idomic/32/15752_2.png) [@idomic](https://discourse.gohugo.io/u/idomic)\
**Post date:** [February 5, 2022, 1:34pm UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/6 "2022-02-05T13:34:26Z")

</div>

Thanks, I’ve added it but still no change.  
What’s weirder is that locally I think it includes the whole url:

```auto
<url>
<loc>http://localhost:1313/blog/</loc>
<lastmod>2022-01-26T20:02:29-06:00</lastmod>
<priority>0.5</priority>
</url>

```

But in the website itself it doesn’t:

```auto
<url>
<loc>/blog/</loc>
<lastmod>2022-01-26T20:02:29-06:00</lastmod>
<priority>0.5</priority>
</url>

```

Do I have to use the xml template?

Also, I have this piece in the netlify.toml config:

```auto
[build.environment]
  HUGO_VERSION = "0.85.0"
  HUGO_BASEURL = "/"

```

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 6, 2022, 4:43am UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/7 "2022-02-06T04:43:19Z")

</div>

well 😉 your HUGO\_BASEURL does clearly state what you want there 😉 Give it a full domain name.

As to localhost:1313 - Hugo does that independent from your configuration on running `hugo server`.

Run locally (not with Netlify) `hugo` and see if the sitemap has full URLs. If so, it’s the HUGO\_BASEURL env.

---

<div class="post-metadata">

**Author:** ![idomic](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idomic/32/15752_2.png) [@idomic](https://discourse.gohugo.io/u/idomic)\
**Post date:** [February 6, 2022, 10:51pm UTC](https://discourse.gohugo.io/t/sitexml-is-broken/36989/8 "2022-02-06T22:51:44Z")

</div>

This was it! Thank you for jumping right in, much appreciated!!
