Link to sitemap.xml

Hello,

I’m trying to link to my sitemap.xml with relref, but it doesn’t work. Is it related to this issue or is there another way?

Thanks in advance!

sitemaps mostly sit in the top directory.

For the HTML header

<link rel="alternate" type="application/xml" title="Site Map" href="/sitemap.xml" />

or in markdown

[Sitemap](/sitemap.xml)

2 Likes

2nd version

in CONFIG

[outputFormats.SITEMAP]
    MediaType              = "application/xml"
    BaseName               = "sitemap"
    IsHTML                 = false
    IsPlainText            = true
    noUgly                 = true
    Rel                    = "sitemap"

and

[outputs]
    home                   = [ "HTML", "ATOM", "JSON", "FEED", "MANIFEST", "SITEMAP"]
    section                = [ "HTML", "SITEMAP" ]

generating in the header

{{ range .AlternativeOutputFormats }}
	<link rel={{ .Rel }} type="{{ safeHTML .MediaType.Type }}" href={{ .RelPermalink }}>
{{ end }}

if you miss something, look in my public sample

3 Likes

Thanks a lot! I forgot to mention, that I want to link to it in a markdown file (i.e. blog post).
But I figured, that if the issue #7260 still exists, I have to use your suggested [Sitemap](/sitemap.xml).

In other news, I also didn’t have the sitemap in the header, so thanks for your 2nd version as well! :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.