From cee9e3c1667d1cf453b248d76175d7d42afa286d Mon Sep 17 00:00:00 2001 From: paoloredis Date: Thu, 12 Sep 2024 11:04:10 +0200 Subject: [PATCH 1/2] Add support for versioned products --- assets/css/index.css | 99 ++++++++++++++++++++++++++++++++++ insert_url_frontmatter.bash | 16 ++++++ layouts/operate/list.html | 1 + layouts/operate/single.html | 1 + layouts/partials/docs-nav.html | 24 +++++++++ layouts/partials/scripts.html | 81 ++++++++++++++++++++++++++++ 6 files changed, 222 insertions(+) create mode 100755 insert_url_frontmatter.bash create mode 100644 layouts/partials/scripts.html diff --git a/assets/css/index.css b/assets/css/index.css index f853ee80a0..ec86e95f8b 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -969,4 +969,103 @@ code { /* no-click turns off border and click event on small icons */ a[href*="#no-click"], img[src*="#no-click"] { @apply border-none cursor-default pointer-events-none no-underline; +} + +/* Version selector in side menu */ +.menu__version-selector { + float: right; + left: 18px; + padding: 0 22px 0; + position: relative; + top: -28px; + z-index: 1; + border: 1px solid #dfdfdf; +} + +.menu__version-selector button { + background: transparent; + border: none; + font-size: 13px; + outline: none; +} + +.menu__version-selector button span.menu__version-selector__toggler { + display: none; + font-size: 8px; + transform: translateY(-1px) translateX(2px); +} + +.menu__version-selector span.menu__version-selector__toggler.opener { + display: inline-block; +} + +.menu__version-selector span.menu__version-selector__toggler.closer { + display: none; +} + +.menu__version-selector .menu__version-selector__list { + background: #f7f7f7; + border: 1px solid #dfdfdf; + border-top: none; + display: none; + font-size: 13px; + left: -1px; + position: absolute; + width: calc(100% + 2px); + z-index: 1; +} + +.menu__version-selector .menu__version-selector__list a { + color: #868484; + display: block; + padding-left: 10px; + width: 100%; +} + +.menu__version-selector .menu__version-selector__list a:hover { + color: #000; +} + +.menu__version-selector .menu__version-selector__list a.selected-version { + display: none; +} + +.menu__version-selector.open { + border: 1px solid #dfdfdf; +} + +.menu__version-selector.open .menu__version-selector__toggler.opener { + display: none; +} + +.menu__version-selector.open .menu__version-selector__toggler.closer { + display: inline-block; +} + +.menu__version-selector.open .menu__version-selector__list { + display: block; +} + +.menu__version-selector > li .menu-divider { + border-top: 1px solid #5d6876; + height: 1px; + left: 20px; + margin-left: 0 !important; + position: absolute; + top: 10px; + width: calc(100% - 20px); +} + +.menu__version-selector > li > .children { + display: none; +} + +.menu__version-selector > li.parent > .children { + display: flex; + position: relative; + padding-top: 60px; +} + +.dd-item .highlight:hover { + color: #5961ff; } \ No newline at end of file diff --git a/insert_url_frontmatter.bash b/insert_url_frontmatter.bash new file mode 100755 index 0000000000..cbbd7c5791 --- /dev/null +++ b/insert_url_frontmatter.bash @@ -0,0 +1,16 @@ +#!/bin/bash +dir="$1" +pages="$(find $dir -name "*.md")" + +for page in $pages; do + if [[ "$page" =~ \/_index.md$ ]]; then + url=$(sed "s/_index.md$/'/; s/^content/'/"<<< $page) + else + url=$(sed "s/.md$/\/'/; s/^content/'/"<<< $page) + fi + # skip if url property is already present + if ! grep -q "$url" $page; then + awk -v url="$url" '$1 == "---" {delim++; if (delim==2){printf "%s\n", "url: "url}} {print}' $page > tmp.md + mv tmp.md $page + fi +done \ No newline at end of file diff --git a/layouts/operate/list.html b/layouts/operate/list.html index 674d0c8d99..d3b03e7237 100644 --- a/layouts/operate/list.html +++ b/layouts/operate/list.html @@ -54,5 +54,6 @@

{{ partial "docs-toc.html" . }} + {{ partial "scripts.html" . }} {{ end }} diff --git a/layouts/operate/single.html b/layouts/operate/single.html index 36b11cc3b9..21f59282a7 100644 --- a/layouts/operate/single.html +++ b/layouts/operate/single.html @@ -40,5 +40,6 @@

{{ partial "docs-toc.html" . }} + {{ partial "scripts.html" . }} {{ end }} diff --git a/layouts/partials/docs-nav.html b/layouts/partials/docs-nav.html index 249031067f..d46cd287e2 100644 --- a/layouts/partials/docs-nav.html +++ b/layouts/partials/docs-nav.html @@ -17,7 +17,31 @@ {{ end -}} {{.LinkTitle}} + {{if (eq (.Params.linkTitle) "Redis for Kubernetes")}} + + {{else if (eq (.Params.linkTitle) "Redis Software")}} + + + {{end}} {{ if and (gt (len $childPages) 0) (or $isActive $isActivePath)}}