aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--site/_layouts/documentation.html7
-rw-r--r--site/_sass/docs.scss7
-rw-r--r--site/css/main.scss1
3 files changed, 12 insertions, 3 deletions
diff --git a/site/_layouts/documentation.html b/site/_layouts/documentation.html
index 73e717f8fa..77e46b431d 100644
--- a/site/_layouts/documentation.html
+++ b/site/_layouts/documentation.html
@@ -108,13 +108,14 @@ nav: docs
<div class="col-lg-9">
<a id="gh-edit" class="gh-edit default-hidden"><i class="fa fa-pencil" aria-hidden="true"></i> Edit</a>
<script>
+ var versionDocsURLRegex = /\/versions\/[\w\.]+\/(.*)/;
var ghDocsBazeURL = 'https://github.com/bazelbuild/bazel/tree/master/site/docs/';
var editButton = document.getElementById('gh-edit');
- // if there is an edit button and we are on a doc page but not in the Build Encyclopedia
+ // if there is an edit button and we are not in the Build Encyclopedia
if (editButton
- && window.location.pathname.split('docs/').length > 1
+ && window.location.pathname.match(versionDocsURLRegex)
&& window.location.pathname.lastIndexOf('/be/') == -1) {
- var docFile = window.location.pathname.split('docs/')[1];
+ var docFile = window.location.pathname.match(versionDocsURLRegex)[1];
// some pages are now using markdown :(
if (docFile !== 'bazel-user-manual.html'
&& docFile !== 'build-ref.html'
diff --git a/site/_sass/docs.scss b/site/_sass/docs.scss
new file mode 100644
index 0000000000..95cbf3acb0
--- /dev/null
+++ b/site/_sass/docs.scss
@@ -0,0 +1,7 @@
+.gh-edit {
+ float: right;
+}
+
+.gh-edit.default-hidden {
+ visibility: hidden;
+}
diff --git a/site/css/main.scss b/site/css/main.scss
index 0ee13b8fe5..402b94f682 100644
--- a/site/css/main.scss
+++ b/site/css/main.scss
@@ -5,6 +5,7 @@
@import "footer.scss";
@import "navbar.scss";
@import "sidebar.scss";
+@import "docs.scss";
@import "be.scss";
@import "syntax.scss";