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 66d41ed59 Configurable JavaDocs:  - public links  - robots.txt  - 
sitemap.xml
66d41ed59 is described below

commit 66d41ed593c41bcf13511d529f090ba448243651
Author: Nikita Timofeev <stari...@gmail.com>
AuthorDate: Mon Mar 25 16:13:41 2024 +0300

    Configurable JavaDocs:
     - public links
     - robots.txt
     - sitemap.xml
---
 src/main/site/data/cayenne.yaml                 | 14 +++++++++--
 src/main/site/layouts/partials/docs_header.html | 19 +++++++++-----
 src/main/site/layouts/robots.txt                |  3 +++
 src/main/site/layouts/sitemap.xml               | 33 ++++++++++++++-----------
 4 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/src/main/site/data/cayenne.yaml b/src/main/site/data/cayenne.yaml
index 7ff0f8917..4d5efe5d2 100644
--- a/src/main/site/data/cayenne.yaml
+++ b/src/main/site/data/cayenne.yaml
@@ -32,6 +32,7 @@ releases:
     downloadable: true
     jdk: 1.8
     newRepoLayout: true
+    javaDoc: "online"
 
   - version: "4.1"                            # major version
     latestRevision: "4.1.1"                   # exact latest version
@@ -41,7 +42,11 @@ releases:
     docs: true                                # this version is visible in 
Docs section
     downloadable: true                        # this version is visible in 
Download section, also see "customLink" attribute
     jdk: 1.8                                  # min supported Java version
-    newRepoLayout: true
+    newRepoLayout: true                       # flags affects links to the 
release notes and upgrade
+    javaDoc: "no-index"                       # "no" - no JavaDocs at all,
+                                              # "offline" - downloadable 
offline package
+                                              # "no-index" - online but not 
accessible for the search crawlers (see robots.txt)
+                                              # "online" - online and 
accessible for search crawlers
 
   - version: "4.0"
     latestRevision: "4.0.3"
@@ -52,6 +57,7 @@ releases:
     downloadable: true
     jdk: 1.7
     newRepoLayout: true
+    javaDoc: "no-index"
 
   - version: "3.1"
     latestRevision: "3.1.3"
@@ -61,6 +67,7 @@ releases:
     docs: true
     downloadable: true
     jdk: 1.5
+    javaDoc: "offline"
 
   - version: "3.0"
     latestRevision: "3.0.2"
@@ -72,6 +79,7 @@ releases:
     customLink: "cayenne-3.0.2" # custom download link, full link will be like:
                                 # 
http://www.apache.org/dyn/closer.lua/cayenne/{{ customLink }}-src.tar.gz
     jdk: 1.5
+    javaDoc: "no"
 
   - version: "2.0"
     latestRevision: "2.0.4"
@@ -81,6 +89,7 @@ releases:
     docs: false
     downloadable: false
     jdk: 1.5
+    javaDoc: "no"
 
   - version: "1.2"
     latestRevision: "1.2.4"
@@ -89,4 +98,5 @@ releases:
     date: "2007-10-12"
     docs: false
     downloadable: false
-    jdk: 1.5
\ No newline at end of file
+    jdk: 1.5
+    javaDoc: "no"
\ No newline at end of file
diff --git a/src/main/site/layouts/partials/docs_header.html 
b/src/main/site/layouts/partials/docs_header.html
index 459aec8f3..6f1820e3f 100644
--- a/src/main/site/layouts/partials/docs_header.html
+++ b/src/main/site/layouts/partials/docs_header.html
@@ -65,12 +65,19 @@
                     {{ end -}}
                     {{- end }}
                     <div class="cd-toc-item">
-                        {{- if eq "3.1" $docVersion }}
-                        <!-- Download offline JavaDocs for the legacy Cayenne 
3.1 -->
-                        <a class="cd-toc-link" 
href="/docs/Apache_Cayenne_v3.1_javadoc.zip">Download JavaDoc</a>
-                        {{- else }}
-                        <a class="cd-toc-link" href="/docs/{{ $docVersion 
}}/api/">JavaDoc</a>
-                        {{- end }}
+                        <!-- this range should return a single collection 
element,
+                        but we don't check it here and just iterate on all 
elements returned -->
+                        {{- range where $.Site.Data.cayenne.releases "version" 
$docVersion -}}
+                        {{- if or (eq .javaDoc "online") (eq .javaDoc 
"no-index") }}
+                        <!-- Online version of JavaDocs -->
+                        <a class="cd-toc-link" href="/docs/{{ .version 
}}/api/">JavaDoc</a>
+                        {{- else -}}
+                        {{- if eq .javaDoc "offline" -}}
+                        <!-- Offline package of JavaDocs for the legacy 
Cayenne versions -->
+                        <a class="cd-toc-link" href="/docs/Apache_Cayenne_v{{ 
.version }}_javadoc.zip">Download JavaDoc</a>
+                        {{- end -}}
+                        {{- end -}}
+                        {{- end -}}
                     </div>
                 </div>
             </div>
diff --git a/src/main/site/layouts/robots.txt b/src/main/site/layouts/robots.txt
index dd5e4c39e..48d5c99d0 100644
--- a/src/main/site/layouts/robots.txt
+++ b/src/main/site/layouts/robots.txt
@@ -1,3 +1,6 @@
 User-agent: *
 Allow: *
+{{- range where $.Site.Data.cayenne.releases "javaDoc" "no-index" }}
+Disallow: /docs/{{ .version }}/api/*
+{{- end }}
 Sitemap: {{ .Site.BaseURL }}sitemap.xml
\ No newline at end of file
diff --git a/src/main/site/layouts/sitemap.xml 
b/src/main/site/layouts/sitemap.xml
index f835d05e1..346a73d26 100644
--- a/src/main/site/layouts/sitemap.xml
+++ b/src/main/site/layouts/sitemap.xml
@@ -8,21 +8,26 @@
   {{- 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 }}
+    <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 }}
+  {{- $baseUrl := .Site.BaseURL -}}
+  {{- range where $.Site.Data.cayenne.releases "javaDoc" "online" }}
+  <url>
+    <loc>{{ $baseUrl }}docs/{{ .version }}/api/</loc>
+  </url>
+  <url>
+    <loc>{{ $baseUrl }}docs/{{ .version }}/api/index-all.html</loc>
+  </url>
+  {{- end }}
 </urlset>

Reply via email to