Skip to content

Commit 6232c03

Browse files
Added Latest LTS versions entry if current branch is lts
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
1 parent 0cae6d4 commit 6232c03

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

generator/_scripts/cfdoc_patch_header_nav.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,20 @@
2525
import sys
2626

2727

28-
def patch(current_branch):
28+
def patch(current_branch, lts_version):
2929
url = "https://docs.cfengine.com/docs/branches.json"
3030
response = urllib.request.urlopen(url)
3131
data = json.loads(response.read())
3232

3333
with open("_includes/header_nav_options.html", "w") as f:
34+
# Add Latest LTS entry if current branch is lts
35+
if current_branch == "lts":
36+
print(
37+
'<a onclick="selectVersion(\'javascript:void(0);\')" href="#" selected="selected">Latest LTS (%s)</a>'
38+
% lts_version,
39+
file=f,
40+
)
41+
3442
for branch in data["docs"]:
3543
if (
3644
"(LTS)" not in branch["Title"]

generator/_scripts/cfdoc_preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
linkresolver.run(config)
4646
# generate links to known targets
4747
linkresolver.apply(config)
48-
patch_header_nav.patch(sys.argv[1])
48+
patch_header_nav.patch(sys.argv[1], sys.argv[2])
4949
references_resolver.run(config)
5050
shortcodes_resolver.run(config)
5151
images_path_resolver.run(config)

generator/build/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,4 @@ set +x
147147
export LC_ALL=C.UTF-8
148148
bash ./build/install_hugo.sh
149149
echo "+ bash -x ./_scripts/_run.sh $BRANCH || exit 6"
150-
bash -x ./_scripts/_run.sh "$BRANCH" || exit 6
150+
bash -x ./_scripts/_run.sh "$BRANCH" "$LTS_VERSION" || exit 6

0 commit comments

Comments
 (0)