"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hugolib/sitemap_test.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

sitemap_test.go  (hugo-0.80.0):sitemap_test.go  (hugo-0.81.0)
skipping to change at line 28 skipping to change at line 28
"testing" "testing"
qt "github.com/frankban/quicktest" qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/config" "github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/deps" "github.com/gohugoio/hugo/deps"
"github.com/gohugoio/hugo/tpl" "github.com/gohugoio/hugo/tpl"
) )
const sitemapTemplate = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/ 0.9"> const sitemapTemplate = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/ 0.9">
{{ range .Data.Pages }} {{ range .Data.Pages }}
{{- if .Permalink -}}
<url> <url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</las tmod>{{ end }}{{ with .Sitemap.ChangeFreq }} <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</las tmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }} <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }} <priority>{{ .Sitemap.Priority }}</priority>{{ end }}
</url> </url>
{{- end -}}
{{ end }} {{ end }}
</urlset>` </urlset>`
func TestSitemapOutput(t *testing.T) { func TestSitemapOutput(t *testing.T) {
t.Parallel() t.Parallel()
for _, internal := range []bool{false, true} { for _, internal := range []bool{false, true} {
doTestSitemapOutput(t, internal) doTestSitemapOutput(t, internal)
} }
} }
skipping to change at line 83 skipping to change at line 85
// Section // Section
"<loc>http://auth/bub/sect/</loc>", "<loc>http://auth/bub/sect/</loc>",
// Tax terms // Tax terms
"<loc>http://auth/bub/categories/</loc>", "<loc>http://auth/bub/categories/</loc>",
// Tax list // Tax list
"<loc>http://auth/bub/categories/hugo/</loc>", "<loc>http://auth/bub/categories/hugo/</loc>",
) )
content := readDestination(th, th.Fs, outputSitemap) content := readDestination(th, th.Fs, outputSitemap)
c.Assert(content, qt.Not(qt.Contains), "404") c.Assert(content, qt.Not(qt.Contains), "404")
c.Assert(content, qt.Not(qt.Contains), "<loc></loc>")
} }
func TestParseSitemap(t *testing.T) { func TestParseSitemap(t *testing.T) {
t.Parallel() t.Parallel()
expected := config.Sitemap{Priority: 3.0, Filename: "doo.xml", ChangeFreq : "3"} expected := config.Sitemap{Priority: 3.0, Filename: "doo.xml", ChangeFreq : "3"}
input := map[string]interface{}{ input := map[string]interface{}{
"changefreq": "3", "changefreq": "3",
"priority": 3.0, "priority": 3.0,
"filename": "doo.xml", "filename": "doo.xml",
"unknown": "ignore", "unknown": "ignore",
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)