HUGO

I am creating a second sitemap, but unsuccessfull

Hi, I am creating a new sitemap for my posts

so I stored file in my default

/layouts/_default/post-sitemap.xml

The code

{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\"?><?xml-stylesheet type=\"text/xsl\" href=\"/css/sitemap.xsl\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	{{- range where .Site.RegularPages "Section" "isset" "posts" }}
	<url>
	   	<loc>{{ .Permalink | absURL }}</loc>
        <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>
	</url>
	{{- end }}
</urlset>

and the config

[outputFormats.POSTSITEMAP]
    MediaType              = "application/xml"
    BaseName               = "post-sitemap"
    IsHTML                 = false
    IsPlainText            = true

[outputs]
  home = ["HTML", "POSTSITEMAP", "RSS"]

But the error is

found no layout file for "postsitemap" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

What is the solution. Please help me…

rename the template to home.postsitemap.xml

1 Like

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