This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne-website.git


The following commit(s) were added to refs/heads/master by this push:
     new f92752379 Fix content of `sitemap.xml`
f92752379 is described below

commit f92752379c5c3835ac281d7a8f34b16643a973cb
Author: Nikita Timofeev <stari...@gmail.com>
AuthorDate: Fri Mar 22 18:17:34 2024 +0300

    Fix content of `sitemap.xml`
---
 src/main/site/config.yaml         |  4 ++++
 src/main/site/layouts/sitemap.xml | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/main/site/config.yaml b/src/main/site/config.yaml
index 46ee2ce26..80e522d9f 100644
--- a/src/main/site/config.yaml
+++ b/src/main/site/config.yaml
@@ -32,6 +32,10 @@ disablePathToLower: true
 enableRobotsTXT: true
 #googleAnalytics: 'UA-7036673-1' # disabled per Apache privacy policy
 
+params:
+  sitemapExcludes: ["/categories/", "/tags/", "/about/", "/legacy/", 
"/collaboration/",
+                    "/docs/", "/docs/3.1/", "/docs/4.0/", "/docs/4.1/", 
"/docs/4.2/"]
+
 mediaTypes:
   application/rdf:
     suffixes:
diff --git a/src/main/site/layouts/sitemap.xml 
b/src/main/site/layouts/sitemap.xml
new file mode 100644
index 000000000..f835d05e1
--- /dev/null
+++ b/src/main/site/layouts/sitemap.xml
@@ -0,0 +1,28 @@
+{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | 
safeHTML }}
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";
+        xmlns:xhtml="http://www.w3.org/1999/xhtml";>
+  {{- $pagesInSitemap := .Data.Pages -}}
+  {{- if .Site.Params.sitemapExcludes -}}
+  {{- $pagesInSitemap = where .Data.Pages "RelPermalink" "not in" 
.Site.Params.sitemapExcludes -}}
+  {{- end -}}
+  {{- range $pagesInSitemap  -}}
+  {{- 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 }}{{ if .IsTranslated 
}}{{ range .Translations }}
+    <xhtml:link
+      rel="alternate"
+      hreflang="{{ .Language.LanguageCode }}"
+      href="{{ .Permalink }}"
+    />{{ end }}
+    <xhtml:link
+      rel="alternate"
+      hreflang="{{ .Language.LanguageCode }}"
+      href="{{ .Permalink }}"
+    />{{ end }}
+  </url>
+  {{- end -}}
+  {{ end }}
+</urlset>

Reply via email to