Improved documentation versioning (#3569)

* add navbar-version-selector.html

* update site/build_docs.py

* update site/build_docs.py

* update _index.html and fix mistakes in config.toml

* fix _index.html

* replace all tabs with spaces

* update navbar-version-selector.html

* fix link in the site/readme.md

* replace tabs with spaces in custom.scss and 404.html

* fix linter errors
main
Timur Osmanov 5 years ago committed by GitHub
parent 3800a91e03
commit 35f5be2632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,7 +44,7 @@ To build and preview your site locally, use:
cd <your local directory>/cvat/site/
hugo server
By default, your site will be available at<http://localhost:1313/>.
By default, your site will be available at<http://localhost:1313/docs/>.
Instead of a "hugo server" command, you can use the "hugo" command that generates the site into a "public" folder.

@ -54,7 +54,8 @@ def generate_docs(repo, output_dir, tags):
generate_versioning_config(os.path.join(cwd, 'site', 'versioning.toml'), (t.name for t in tags), '/..')
for tag in tags:
repo.git.checkout(tag.name)
repo.git.checkout(tag.name, '--', 'site/content/en/docs')
repo.git.checkout(tag.name, '--', 'site/content/en/images')
destination_dir = os.path.join(output_dir, tag.name)
os.makedirs(destination_dir)
run_hugo(content_loc, destination_dir)

@ -58,7 +58,7 @@ anchor = "smart"
[services]
[services.googleAnalytics]
# Comment out the next line to disable GA tracking. Also disables the feature described in [params.ui.feedback].
id = "UA-00000000-0"
# id = "UA-00000000-0"
# Language configuration

@ -3,6 +3,8 @@ title = "Home"
linkTitle = "Home"
+++
<meta http-equiv="refresh" content="0; URL=/cvat/about">
{{< blocks/section height="full" color="docs" >}}
<section id="temporary-page" class="mx-auto text-center py-5">

@ -1,9 +1,9 @@
{{ define "main"}}
<main id="main">
<div class="text-center">
<h1>404</h1>
<p>Not found</p>
<p>Oops! This page doesn't exist. Try going back to our <a href="./about">about page</a> or <a href="./docs">documentation page</a>.</p>
</div>
</main>
<main id="main">
<div class="text-center">
<h1>404</h1>
<p>Not found</p>
<p>Oops! This page doesn't exist. Try going back to our <a href="./about">about page</a> or <a href="./docs">documentation page</a>.</p>
</div>
</main>
{{ end }}

@ -26,9 +26,9 @@
<div class="footer-disclaimer text-white ">
<small>Intel technologies may require enabled hardware, software or service activation. // No product or component can be absolutely secure. // Your costs and results may vary. // Performance varies by use, configuration and other factors. // See our complete legal <u><a href="https://edc.intel.com/content/www/us/en/products/performance/benchmarks/overview/?r=219444055">Notices and Disclaimers</a></u>. // Intel is committed to respecting human rights and avoiding complicity in human rights abuses. See Intels <a href="https://www.intel.com/content/www/us/en/policy/policy-human-rights.html"><u>Global Human Rights Principles</u></a>. Intels products and software are intended only to be used in applications that do not cause or contribute to a violation of an internationally recognized human right.</small>
</div>
{{ if not .Site.Params.ui.footer_about_disable }}
{{ with .Site.GetPage "about" }}<p class="mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>{{ end }}
{{ end }}
{{ if not .Site.Params.ui.footer_about_disable }}
{{ with .Site.GetPage "about" }}<p class="mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>{{ end }}
{{ end }}
</div>
</div>
</div>

@ -0,0 +1,11 @@
{{ $page_rel := .Page.RelPermalink | safeURL }}
{{ $page_rel_trim := strings.TrimLeft "/" $page_rel | safeURL }}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ .Site.Params.version_menu }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
{{ range .Site.Params.versions }}
{{ $ver := .version }}
<a class="dropdown-item" href="{{ .url }}{{ if eq $ver "develop" }}{{ $page_rel_trim }}{{ else }}{{ $page_rel }}{{ end }}">{{ $ver }}</a>
{{ end }}
</div>

@ -1,35 +1,35 @@
{{ $cover := .HasShortcode "blocks/cover" }}
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark {{ if $cover}} td-navbar-cover {{ end }}flex-column flex-md-row td-navbar">
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}about/">
<span class="navbar-logo">{{ if .Site.Params.ui.navbar_logo }}{{ with resources.Get "icons/logo.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}{{ end }}</span>
</a>
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
<ul class="navbar-nav mt-2 mt-lg-0">
{{ $p := . }}
{{ range .Site.Menus.main }}
<li class="nav-item mr-4 mb-2 mb-lg-0">
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }}
{{ with .Page }}
{{ $active = or $active ( $.IsDescendant .) }}
{{ end }}
{{ $pre := .Pre }}
{{ $post := .Post }}
{{ $url := urls.Parse .URL }}
{{ $baseurl := urls.Parse $.Site.Params.Baseurl }}
<a class="nav-link{{if $active }} active{{end}}" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}" {{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ with .Pre}}{{ $pre }}{{ end }}<span{{if $active }} class="active"{{end}}>{{ .Name }}</span>{{ with .Post}}{{ $post }}{{ end }}</a>
</li>
{{ end }}
{{ if .Site.Params.versions }}
<li class="nav-item dropdown d-none d-lg-block">
{{ partial "navbar-version-selector.html" . }}
</li>
{{ end }}
{{ if (gt (len .Site.Home.Translations) 0) }}
<li class="nav-item dropdown d-none d-lg-block">
{{ partial "navbar-lang-selector.html" . }}
</li>
{{ end }}
</ul>
</div>
<div class="navbar-nav d-none d-lg-block">{{ partial "search-input.html" . }}</div>
<span class="navbar-logo">{{ if .Site.Params.ui.navbar_logo }}{{ with resources.Get "icons/logo.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}{{ end }}</span>
</a>
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
<ul class="navbar-nav mt-2 mt-lg-0">
{{ $p := . }}
{{ range .Site.Menus.main }}
<li class="nav-item mr-4 mb-2 mb-lg-0">
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }}
{{ with .Page }}
{{ $active = or $active ( $.IsDescendant .) }}
{{ end }}
{{ $pre := .Pre }}
{{ $post := .Post }}
{{ $url := urls.Parse .URL }}
{{ $baseurl := urls.Parse $.Site.Params.Baseurl }}
<a class="nav-link{{if $active }} active{{end}}" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}" {{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ with .Pre}}{{ $pre }}{{ end }}<span{{if $active }} class="active"{{end}}>{{ .Name }}</span>{{ with .Post}}{{ $post }}{{ end }}</a>
</li>
{{ end }}
{{ if .Site.Params.versions }}
<li class="nav-item dropdown d-none d-lg-block">
{{ partial "navbar-version-selector.html" . }}
</li>
{{ end }}
{{ if (gt (len .Site.Home.Translations) 0) }}
<li class="nav-item dropdown d-none d-lg-block">
{{ partial "navbar-lang-selector.html" . }}
</li>
{{ end }}
</ul>
</div>
<div class="navbar-nav d-none d-lg-block">{{ partial "search-input.html" . }}</div>
</nav>

Loading…
Cancel
Save