diff options
author | steren <steren@google.com> | 2017-06-27 17:38:41 +0200 |
---|---|---|
committer | Marcel Hlopko <hlopko@google.com> | 2017-06-28 10:17:35 +0200 |
commit | 9b394a24dc65c794242e98a8a41eb8a60c78367b (patch) | |
tree | c515426f9f705d857d5bbb33ddaafe2810b59bc0 /site/_layouts | |
parent | ebec92588c1b67b85b8c64564105faa62664d4f4 (diff) |
Bazel docs: Fix Edit button
The new doc website has a new URL structure. This change adapts the page extraction code.
It also restores the CSS for the edit button which got deleted during refactoring.
Fix #3272
RELNOTES: None
PiperOrigin-RevId: 160279009
Diffstat (limited to 'site/_layouts')
-rw-r--r-- | site/_layouts/documentation.html | 7 |
1 files changed, 4 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' |