This is an automated email from the ASF dual-hosted git repository. pabloem pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push: new c38bc61aeeb [Website] add guard expressions to fix-menu and page-nav new 610323d1e62 Merge pull request #21731 from [Website] add guard expressions to fix-menu and page-nav c38bc61aeeb is described below commit c38bc61aeebbded0efb4411a377a95d97f10b1f2 Author: bulat safiullin <bulat.safiul...@akvelon.com> AuthorDate: Tue Jun 7 16:26:00 2022 +0600 [Website] add guard expressions to fix-menu and page-nav add guard expressions to fix-menu and page-nav, add separate head.html to homepage, add baseof.html to homepage --- website/www/site/assets/js/fix-menu.js | 9 ++- website/www/site/assets/js/page-nav.js | 15 ++-- website/www/site/layouts/baseof.html | 37 ++++++++++ .../www/site/layouts/partials/head_homepage.html | 83 ++++++++++++++++++++++ 4 files changed, 137 insertions(+), 7 deletions(-) diff --git a/website/www/site/assets/js/fix-menu.js b/website/www/site/assets/js/fix-menu.js index eeb4298ae50..36cfbf3c86e 100644 --- a/website/www/site/assets/js/fix-menu.js +++ b/website/www/site/assets/js/fix-menu.js @@ -64,9 +64,14 @@ $(document).ready(function() { } }); }, + "isMenuPresent": function () { + return $("." + idMenu).length > 0 + }, "init": function() { - this.menuConfig = $("." + this.idMenu).data(); - this.bindEvents(); + if (this.isMenuPresent()) { + this.menuConfig = $("." + this.idMenu).data(); + this.bindEvents(); + } } } } diff --git a/website/www/site/assets/js/page-nav.js b/website/www/site/assets/js/page-nav.js index 8bc72957512..f29f7044980 100644 --- a/website/www/site/assets/js/page-nav.js +++ b/website/www/site/assets/js/page-nav.js @@ -117,12 +117,17 @@ $(document).ready(function() { }); }, + "isContainerPresent": function () { + return $("." + idMainContainer).length > 0 + }, + "init": function() { - this.bindEvents(); - this.setPageNav(); - this.prependArrows(); - this.setNavEvents(); - this.refreshScrollSpy(); + if (this.isContainerPresent()) { + this.bindEvents(); + this.setPageNav(); + this.prependArrows(); + this.setNavEvents(); + } } } } diff --git a/website/www/site/layouts/baseof.html b/website/www/site/layouts/baseof.html new file mode 100644 index 00000000000..b8c89d8b52e --- /dev/null +++ b/website/www/site/layouts/baseof.html @@ -0,0 +1,37 @@ +{{/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. See accompanying LICENSE file. +*/}} + +<!DOCTYPE html> +<html lang="{{ .Site.Language.Lang }}" class="no-js"> +<head> + {{ partial "head_homepage" . }} +</head> +<body class="body body--index"> + {{ partial "header.html" . }} + <div class="body__contained no__padding"> + {{ block "hero-section" . }}{{ end }} + {{ block "ctas-section" . }}{{ end }} + {{ block "graphic-section" . }}{{ end }} + {{ block "pillars-section" . }}{{ end }} + {{ block "logos-section" . }}{{ end }} + {{ block "pipelines-section" . }}{{ end }} + {{ block "playground-section" . }}{{ end }} + {{ block "quotes-section" . }}{{ end }} + {{ block "quotes-mobile-section" . }}{{ end }} + {{ block "calendar-section" . }}{{ end }} + </div> + <div class="main-padding"> + {{ partial "footer.html" . }} + </div> + {{ partial "hooks/body-end.html"}} +</body> +</html> diff --git a/website/www/site/layouts/partials/head_homepage.html b/website/www/site/layouts/partials/head_homepage.html new file mode 100644 index 00000000000..228abf41ab6 --- /dev/null +++ b/website/www/site/layouts/partials/head_homepage.html @@ -0,0 +1,83 @@ +{{/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. See accompanying LICENSE file. +*/}} + +<meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1"> + +<title>{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}</title> +<meta name="description" content="{{ .Description | default $.Site.Params.description }}"> + +<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700" rel="stylesheet"> + +{{ $scssMain := "scss/main.scss"}} +{{ if .Site.IsServer }} + {{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" true) | postCSS }} + <link href="{{ $css.RelPermalink }}" rel="stylesheet"> +{{ else }} + {{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" false) | postCSS | minify | fingerprint }} + <link rel="preload" href="{{ $css.RelPermalink }}" as="style"> + <link href="{{ $css.RelPermalink }}" rel="stylesheet" integrity="{{ $css.Data.integrity }}"> +{{ end }} + +<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> + +<style> + .body__contained img { max-width: 100% } +</style> + +{{ $bootstrap := resources.Get "js/bootstrap.min.js" | fingerprint }} +<script type="text/javascript" src="{{ $bootstrap.RelPermalink }}" defer></script> + +<!-- TODO [BEAM-12644]: Create an asset pipeline so we don't have to version .js files. --> +{{ $switchV2 := resources.Get "js/language-switch-v2.js" | minify | fingerprint }} +<script type="text/javascript" src="{{ $switchV2.RelPermalink }}" defer></script> + +{{ $sectionNav := resources.Get "js/section-nav.js" | minify | fingerprint }} +<script type="text/javascript" src="{{ $sectionNav.RelPermalink }}" defer></script> + +{{ $expandableList := resources.Get "js/expandable-list.js" | minify | fingerprint }} +<script type="text/javascript" src="{{ $expandableList.RelPermalink }}" defer></script> + +{{ $copyToClipboard := resources.Get "js/copy-to-clipboard.js" | minify | fingerprint }} +<script type="text/javascript" src="{{ $copyToClipboard.RelPermalink }}" defer></script> + +{{ $calendar := resources.Get "js/calendar.js" | minify | fingerprint }} +<script type="text/javascript" src="{{ $calendar.RelPermalink }}" defer></script> + +<link rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" href="/feed.xml"> +<link rel="canonical" href="{{ .Site.Params.hostName }}{{ .Permalink | absURL }}" data-proofer-ignore> +<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico"> +<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous"> +<link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css"/> +<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> + +<script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + ga('create', 'UA-73650088-1', 'auto'); + ga('send', 'pageview'); +</script> + +<!-- Hotjar Tracking Code for https://beam.apache.org/ --> +<script> + (function(h,o,t,j,a,r){ + h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)}; + h._hjSettings={hjid:2182187,hjsv:6}; + a=o.getElementsByTagName('head')[0]; + r=o.createElement('script');r.async=1; + r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv; + a.appendChild(r); + })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv='); +</script>