+++
Front Matter with Ordered Pages 4. This is longer content`
+var weightedPage5 = `+++
+weight = "5"
+title = "Five"
+
+[_build]
+render = "never"
++++
+Front Matter with Ordered Pages 5`
+
var weightedSources = [][2]string{
{filepath.FromSlash("sect/doc1.md"), weightedPage1},
{filepath.FromSlash("sect/doc2.md"), weightedPage2},
{filepath.FromSlash("sect/doc3.md"), weightedPage3},
{filepath.FromSlash("sect/doc4.md"), weightedPage4},
+ {filepath.FromSlash("sect/doc5.md"), weightedPage5},
}
func TestOrderedPages(t *testing.T) {
b := newTestSitesBuilder(t)
b.WithConfigFile("toml", fmt.Sprintf(`
-
-
+
+
minify = %t
[build]
`, minify))
b.WithTemplates("index.html", `
-
+
<div id="el1" class="a b c">Foo</div>
Some text.
b := newTestSitesBuilder(t)
b.WithConfigFile("toml", `
-
+
disableKinds = ["home", "section", "term", "taxonomy" ]
[languages]
const sitemapTemplate = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ range .Data.Pages }}
+ {{- if .Permalink -}}
<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 }}
</url>
+ {{- end -}}
{{ end }}
</urlset>`
content := readDestination(th, th.Fs, outputSitemap)
c.Assert(content, qt.Not(qt.Contains), "404")
+ c.Assert(content, qt.Not(qt.Contains), "<loc></loc>")
}
func TestParseSitemap(t *testing.T) {
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
+ {{- if .Permalink -}}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
href="{{ .Permalink }}"
/>{{ end }}
</url>
+ {{- end -}}
{{ end }}
</urlset>
`},
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
+ {{- if .Permalink -}}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
href="{{ .Permalink }}"
/>{{ end }}
</url>
+ {{- end -}}
{{ end }}
</urlset>