# Excluding port from sitemap baseurl

**URL:** <https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604>\
**Category:** support\
**Created:** [October 6, 2018, 11:32pm UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604 "2018-10-06T23:32:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![foggy](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@foggy](https://discourse.gohugo.io/u/foggy)\
**Post date:** [October 6, 2018, 11:32pm UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/1 "2018-10-06T23:32:50Z")

</div>

I’m using `hugo server -b http://baseurl.com/` as a command to serve my hugo site as a service on linux (I know this isn’t recommended but hey, it’s working). localhost:1313 is reverse proxy’d behind nginx. Visitors go to [http://baseurl.com](http://baseurl.com) and yay it works.

The issue is, in my sitemap, the urls are all `http://baseurl.com:1313/`. I… don’t want the port there, and I don’t want to have to change my port just for this issue.

1. Is there a flag for server that exists as is to get around this?
2. Is there a quick edit I can make to the sitemap generator or some variable to avoid this?

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [October 6, 2018, 11:40pm UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/2 "2018-10-06T23:40:54Z")

</div>

See the `-p` option

> **[hugo server](https://gohugo.io/commands/hugo_server/#options)**
>
> hugo server A high performance webserver
> Synopsis Hugo provides its own webserver which builds and serves the site. While hugo server is high performance, it is a webserver with limited options. Many run it in production, but the standard behavior is...

---

<div class="post-metadata">

**Author:** ![foggy](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@foggy](https://discourse.gohugo.io/u/foggy)\
**Post date:** [October 6, 2018, 11:47pm UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/3 "2018-10-06T23:47:16Z")

</div>

I am aware that I can change the port, but given that I have it successfully reverse-proxied, I would prefer to not have to specify a different port just because the sitemap (and literally nothing else) is incorrect.

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [October 6, 2018, 11:57pm UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/4 "2018-10-06T23:57:29Z")

</div>

I have a feeling that, if you decide to try to run `hugo server` in production, all of these various scenarios that are possible are not fully tested, despite the “Many run it in production” statement. Probably better to just use hugo to build to a folder, then host the built site’s folder with a bespoke web server.

I suppose you could search around in here and build a custom sitemap template. I imagine it would have to be somewhat hard coded. Not sure, as I haven’t tried this setup.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [October 6, 2018, 11:59pm UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/5 "2018-10-06T23:59:22Z")

</div>

Have you tried setting `—appendPort` to `false` ?

---

<div class="post-metadata">

**Author:** ![foggy](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@foggy](https://discourse.gohugo.io/u/foggy)\
**Post date:** [October 6, 2018, 11:59pm UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/6 "2018-10-06T23:59:27Z")

</div>

I think --appendPort might be what I was looking for but my eyes just kept glancing past it

---

<div class="post-metadata">

**Author:** ![foggy](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@foggy](https://discourse.gohugo.io/u/foggy)\
**Post date:** [October 7, 2018, 12:01am UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/7 "2018-10-07T00:01:58Z")

</div>

Nope, `--appendPort` was not the answer, which is a little worrying. It’s looking more and more like the issue is with decisions made in the realm of sitemap generation specifically.

---

<div class="post-metadata">

**Author:** ![foggy](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@foggy](https://discourse.gohugo.io/u/foggy)\
**Post date:** [October 7, 2018, 12:03am UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/8 "2018-10-07T00:03:48Z")

</div>

I’m a liar! that was it. Thanks everyone.

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [October 7, 2018, 12:24am UTC](https://discourse.gohugo.io/t/excluding-port-from-sitemap-baseurl/14604/9 "2018-10-07T00:24:39Z")

</div>

TIL about `--appendPort`. Nice catch.
