mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
@@ -1,7 +1,7 @@
|
||||
{{ if not site.Config.Privacy.GoogleAnalytics.Disable }}
|
||||
{{- with site.Config.Services.GoogleAnalytics.ID }}
|
||||
{{- if strings.HasPrefix (lower .) "ua-" }}
|
||||
{{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your site configuration with the new value." }}
|
||||
{{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your project configuration with the new value." }}
|
||||
{{- else }}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
|
||||
<script>
|
||||
|
||||
@@ -271,27 +271,27 @@ title: p2
|
||||
{{ .Title }}
|
||||
`
|
||||
|
||||
// Test A: Exclude all pages via site config.
|
||||
// Test A: Exclude all pages via project config.
|
||||
b := hugolib.Test(t, files)
|
||||
b.AssertFileContentExact("public/sitemap.xml",
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">\n \n</urlset>\n",
|
||||
)
|
||||
|
||||
// Test B: Include all pages via site config.
|
||||
// Test B: Include all pages via project config.
|
||||
files_b := strings.ReplaceAll(files, "disable = true", "disable = false")
|
||||
b = hugolib.Test(t, files_b)
|
||||
b.AssertFileContentExact("public/sitemap.xml",
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">\n <url>\n <loc>/p1/</loc>\n </url><url>\n <loc>/p2/</loc>\n </url>\n</urlset>\n",
|
||||
)
|
||||
|
||||
// Test C: Exclude all pages via site config, but include p1 via front matter.
|
||||
// Test C: Exclude all pages via project config, but include p1 via front matter.
|
||||
files_c := strings.ReplaceAll(files, "p1_disable: foo", "disable: false")
|
||||
b = hugolib.Test(t, files_c)
|
||||
b.AssertFileContentExact("public/sitemap.xml",
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">\n <url>\n <loc>/p1/</loc>\n </url>\n</urlset>\n",
|
||||
)
|
||||
|
||||
// Test D: Include all pages via site config, but exclude p1 via front matter.
|
||||
// Test D: Include all pages via project config, but exclude p1 via front matter.
|
||||
files_d := strings.ReplaceAll(files_b, "p1_disable: foo", "disable: true")
|
||||
b = hugolib.Test(t, files_d)
|
||||
b.AssertFileContentExact("public/sitemap.xml",
|
||||
|
||||
Reference in New Issue
Block a user