Skip to content

Commit

Permalink
Disable search on all docs except latest version (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored May 14, 2022
1 parent dc4960b commit 62c430d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release

on:
create:
push:
branches: [ main ]
tags: ["release-*.*.*"]

Expand Down
8 changes: 5 additions & 3 deletions themes/jaeger-docs/layouts/index.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{ $latestVersion := site.Params.latest }}
{{ $index := newScratch }}
{{ $index.Add "index" slice }}
{{ range where site.Pages "Section" "docs" }}
{{ $version := index (split .File.Path "/") 1 }}
{{ $index.Add "index" (dict "title" .Title "url" .Permalink "body" (.Content | plainify | jsonify) "summary" .Summary "version" $version) }}
{{ end }}
{{ $version := index (split .File.Path "/") 1 }}
{{ if eq $version $latestVersion }}
{{ $index.Add "index" (dict "title" .Title "url" .Permalink "body" (.Content | plainify | jsonify) "summary" .Summary "version" $version) }}
{{ end }}{{ end }}
{{ $index.Get "index" | jsonify }}
11 changes: 10 additions & 1 deletion themes/jaeger-docs/layouts/partials/javascript.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{{ $isDocsPage := eq .Section "docs" }}
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
{{ $jsFiles := (slice "jquery-ui-1.9.1.custom.min.js" "anchor.min.js" "tocbot.min.js" "app.js" "lunr-2.3.6.min.js") }}
{{ $jsFiles := (slice "jquery-ui-1.9.1.custom.min.js" "anchor.min.js" "tocbot.min.js" "app.js") }}
{{ range $jsFiles }}
{{ $js := resources.Get (printf "js/%s" .) | minify | fingerprint }}
<script src="{{ $js.Permalink }}" integrity="{{ $js.Data.Integrity }}"></script>
{{ end }}

{{ if $isDocsPage }}
{{ $jsFiles := (slice "lunr-2.3.6.min.js") }}
{{ range $jsFiles }}
{{ $js := resources.Get (printf "js/%s" .) | minify | fingerprint }}
<script src="{{ $js.Permalink }}" integrity="{{ $js.Data.Integrity }}"></script>
{{ end }}
{{ end }}
13 changes: 7 additions & 6 deletions themes/jaeger-docs/layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
{{ $preview := getenv "HUGO_PREVIEW" }}
{{ $isPreview := eq $preview "true" }}
{{ $currentVersion := index (split .File.Path "/") 1 }}
{{ $isDoc := eq .Section "docs" }}
<nav class="navbar is-fixed-top">
<div class="container is-fluid">
<div class="navbar-brand">
Expand All @@ -27,6 +26,7 @@
<div id="topNav" class="navbar-menu">
<div class="navbar-end">
{{ if $isDocsPage }}
{{ if eq $latest $currentVersion }}
<div class="navbar-item">
<div class="dropdown" id="search-dropdown">
<div class="dropdown-trigger">
Expand All @@ -47,10 +47,7 @@
</div>
</div>
{{ end }}

<a class="navbar-item" href="/download">
Download
</a>
{{ end }}

<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
Expand All @@ -66,7 +63,7 @@

{{ with .Params.children }}
{{ range . }}
{{ $url := cond $isDoc (printf "/docs/%s/%s" $currentVersion .url) (printf "/docs/%s/%s" $latest .url) }}
{{ $url := cond $isDocsPage (printf "/docs/%s/%s" $currentVersion .url) (printf "/docs/%s/%s" $latest .url) }}
<a class="navbar-item is-small is-hidden-desktop" href="{{ $url }}">
&cir; {{ if .navtitle }}{{ .navtitle }}{{ else }}{{ .title }}{{ end }}
</a>
Expand Down Expand Up @@ -99,6 +96,10 @@
</div>
{{ end }}

<a class="navbar-item" href="/download">
Download
</a>

<a class="navbar-item" href="https://medium.com/jaegertracing/latest" target="_blank">
Blog
</a>
Expand Down

0 comments on commit 62c430d

Please sign in to comment.