Skip to content

Commit d55a8af

Browse files
committed
Update build script to set default home page.
* BaseUrl has a different outSuffix for each version. So, use a different parameter for the home page. * Use .Site.Params.home in version selector.
1 parent e0b8a1e commit d55a8af

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

scripts/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ def exec(*argv):
1818
raise Exception('Failed to exec ' + " ".join(argv))
1919
return res
2020

21-
22-
def runHugo(outSuffix=""):
21+
def getBaseUrl(outSuffix=""):
2322
baseUrl = "https://tour.dgraph.io/"
2423
if BASE_URL_ENV in os.environ:
2524
baseUrl = os.environ[BASE_URL_ENV]
2625
if baseUrl[-1] != '/':
2726
baseUrl += '/'
2827
baseUrl += outSuffix
28+
return baseUrl
29+
30+
def runHugo(outSuffix=""):
31+
baseUrl = getBaseUrl(outSuffix)
2932

3033
destination = 'public/'
3134
if DEST_ENV in os.environ:
@@ -74,13 +77,13 @@ def buildBranch(branch, dest, jsonData):
7477
def buildAll(releases):
7578
latestRelease = releases[1]
7679
print('Latest Release (recommended to users): ', latestRelease)
77-
7880
def jsonFor(version, latestRelease, releases):
7981
return {
8082
"params": {
8183
"latestRelease": latestRelease,
8284
"tourReleases": releases,
8385
"thisRelease": version,
86+
"home": getBaseUrl()
8487
},
8588
}
8689

themes/hugo-tutorials/layouts/partials/topbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
window.DgTour = {
3030
thisRelease: "{{ $.Site.Params.thisRelease }}",
3131
latestRelease: "{{ $.Site.Params.latestRelease }}",
32-
baseUrl: "{{ $.Site.BaseURL }}"
32+
home: "{{ $.Site.Params.home }}"
3333
}
3434
</script>
3535

themes/hugo-tutorials/static/js/build/dgraph-tour.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/hugo-tutorials/static/js/dgraph.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ $('#tour-release').change(function(e) {
66
return
77
}
88
if (dest == DgTour.latestRelease) {
9-
window.location.href = DgTour.baseUrl;
9+
window.location.href = DgTour.home;
1010
return
1111
}
1212
if (dest != "master") {
1313
dest = "dgraph-" + dest
1414
}
15-
window.location.href = DgTour.baseURL + dest
15+
window.location.href = DgTour.home + dest;
1616
});
1717

1818

0 commit comments

Comments
 (0)