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

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


The following commit(s) were added to refs/heads/master by this push:
     new 49eba99d42 Fix page (#2330)
49eba99d42 is described below

commit 49eba99d422394dc226016537e094bc5a5789202
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Feb 27 21:11:26 2023 +0800

    Fix page (#2330)
---
 layouts/partials/announcement.html | 92 ++++++++++++++++++++++++++------------
 layouts/partials/head.html         |  4 --
 layouts/partials/scripts.html      |  7 +--
 3 files changed, 65 insertions(+), 38 deletions(-)

diff --git a/layouts/partials/announcement.html 
b/layouts/partials/announcement.html
index c48a076ce8..870a4731ff 100755
--- a/layouts/partials/announcement.html
+++ b/layouts/partials/announcement.html
@@ -1,40 +1,76 @@
 {{ $dateRegExp := 
"^[0-9]{4}-1[0-2]|0[1-9]-(?:3[01]|0[1-9]|[12][0-9])T(?:2[0-3]|[01][0-9]):(?:[0-5][0-9]):(?:60|[0-5][0-9])$"
 }}
 {{ $announcementShown := false }}
 
-{{ $currentAnnouncements := $.Site.Data.announcements.zh }}
-{{ if eq .Site.Language.Lang "en" }}
+{{ if eq .Site.LanguagePrefix "/en" }}
   {{ $currentAnnouncements := $.Site.Data.announcements.en }}
-{{ end }}
 
-{{ range $currentAnnouncements }}
-  {{ range .announcements }}
-  {{ if or ( eq .endTime nil ) ( eq .message nil ) }}
-    {{ errorf "Invalid announcement: %#v" . }}
-  {{ end }}
-  {{ if and (ne .startTime nil ) (lt ( len ( findRE $dateRegExp .startTime ) ) 
1 ) }}
-    {{ errorf "Invalid announcement start time: %#v" .startTime }}
-  {{ end }}
-  {{ if lt ( len ( findRE $dateRegExp .endTime ) ) 1 }}
-    {{ errorf "Invalid announcement end time: %#v" .endTime }}
-  {{ end }}
-  {{ if or (eq .startTime nil ) (lt ( time .startTime ) now ) }}
-    {{- if or (eq .endTime nil ) (gt ( time .endTime ) now ) -}}
+  {{ range $currentAnnouncements }}
+    {{ range .announcements }}
+      {{ if or ( eq .endTime nil ) ( eq .message nil ) }}
+      {{ errorf "Invalid announcement: %#v" . }}
+      {{ end }}
+      {{ if and (ne .startTime nil ) (lt ( len ( findRE $dateRegExp .startTime 
) ) 1 ) }}
+      {{ errorf "Invalid announcement start time: %#v" .startTime }}
+      {{ end }}
+      {{ if lt ( len ( findRE $dateRegExp .endTime ) ) 1 }}
+      {{ errorf "Invalid announcement end time: %#v" .endTime }}
+      {{ end }}
+      {{ if or (eq .startTime nil ) (lt ( time .startTime ) now ) }}
+      {{- if or (eq .endTime nil ) (gt ( time .endTime ) now ) -}}
       {{- if not $announcementShown -}}
       {{- $announcementShown = true -}}
-  <div lang="en" id="announcement" style="background-color: #3371e3; color: 
#fff; {{ .style | safeCSS }}">
-    <aside>
-      <div class="announcement-main" data-nosnippet>
-        {{ if .title }}
-        <h4>
-            {{ .title | markdownify }}
-        </h4>
-        {{ end }}
-        <p>{{ .message | markdownify }}</p>
+      <div lang="en" id="announcement" style="background-color: #3371e3; 
color: #fff; {{ .style | safeCSS }}">
+        <aside>
+          <div class="announcement-main" data-nosnippet>
+            {{ if .title }}
+            <h4>
+              {{ .title | markdownify }}
+            </h4>
+            {{ end }}
+            <p>{{ .message | markdownify }}</p>
+          </div>
+        </aside>
       </div>
-    </aside>
-  </div>
       {{- end -}}
       {{- end -}}
+      {{- end -}}
+    {{ end }}
+  {{ end }}
+
+{{ else }}
+  {{ $currentAnnouncements := $.Site.Data.announcements.zh }}
+
+  {{ range $currentAnnouncements }}
+    {{ range .announcements }}
+    {{ if or ( eq .endTime nil ) ( eq .message nil ) }}
+    {{ errorf "Invalid announcement: %#v" . }}
+    {{ end }}
+    {{ if and (ne .startTime nil ) (lt ( len ( findRE $dateRegExp .startTime ) 
) 1 ) }}
+    {{ errorf "Invalid announcement start time: %#v" .startTime }}
+    {{ end }}
+    {{ if lt ( len ( findRE $dateRegExp .endTime ) ) 1 }}
+    {{ errorf "Invalid announcement end time: %#v" .endTime }}
+    {{ end }}
+    {{ if or (eq .startTime nil ) (lt ( time .startTime ) now ) }}
+    {{- if or (eq .endTime nil ) (gt ( time .endTime ) now ) -}}
+    {{- if not $announcementShown -}}
+    {{- $announcementShown = true -}}
+    <div lang="zh-cn" id="announcement" style="background-color: #3371e3; 
color: #fff; {{ .style | safeCSS }}">
+      <aside>
+        <div class="announcement-main" data-nosnippet>
+          {{ if .title }}
+          <h4>
+            {{ .title | markdownify }}
+          </h4>
+          {{ end }}
+          <p>{{ .message | markdownify }}</p>
+        </div>
+      </aside>
+    </div>
+    {{- end -}}
+    {{- end -}}
     {{- end -}}
+    {{ end }}
   {{ end }}
-{{ end }}
\ No newline at end of file
+
+{{ end }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index d5206ba9e0..13a14e43be 100755
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -79,10 +79,6 @@
 <meta property="og:type" content="{{ $ogType }}">
 <meta name="viewport" content="width=device-width">
 
-{{ if .HasShortcode "mermaid" }}
-<!-- Copied from https://unpkg.com/[email protected]/dist/mermaid.min.js -->
-<script async src="{{ "js/mermaid.min.js" | relURL }}"></script>
-{{ end }}
 <!-- Place this tag in your head or just before your close body tag. -->
 <script async defer src="/js/github-buttons.js"></script>
 
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index a05c052474..f4c985b32c 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -2,19 +2,14 @@
 <script src="/js/popper.min.js" 
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
 crossorigin="anonymous"></script>
 <script src="/js/bootstrap.min.js" 
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
 crossorigin="anonymous"></script>
 
-{{ if .Site.Params.mermaid.enable }}
-<script src="/js/mermaid.min.js" 
integrity="sha384-to2w0I1OqmbJ9J6yTnIX+KYU8grNpZoD1dKPLjgEJvMe5L5+/7qvuNa2sQo8WAWj"
 crossorigin="anonymous"></script>
-
-{{ end }}
 
 {{ $jsBase := resources.Get "js/base.js" }}
 {{ $jsAnchor := resources.Get "js/anchor.js" }}
 {{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate 
"js/search.js" .Site.Home }}
-{{ $jsMermaid := resources.Get "js/mermaid.js" | resources.ExecuteAsTemplate 
"js/mermaid.js" . }}
 {{ if .Site.Params.offlineSearch }}
 {{ $jsSearch = resources.Get "js/offline-search.js" }}
 {{ end }}
-{{ $js := (slice $jsBase $jsAnchor $jsSearch $jsMermaid) | resources.Concat 
"js/main.js" }}
+{{ $js := (slice $jsBase $jsAnchor $jsSearch) | resources.Concat "js/main.js" 
}}
 {{ if .Site.IsServer }}
 <script src="{{ $js.RelPermalink }}"></script>
 {{ else }}

Reply via email to