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/ cd <your local directory>/cvat/site/
hugo server 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. 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), '/..') generate_versioning_config(os.path.join(cwd, 'site', 'versioning.toml'), (t.name for t in tags), '/..')
for tag 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) destination_dir = os.path.join(output_dir, tag.name)
os.makedirs(destination_dir) os.makedirs(destination_dir)
run_hugo(content_loc, destination_dir) run_hugo(content_loc, destination_dir)

@ -58,7 +58,7 @@ anchor = "smart"
[services] [services]
[services.googleAnalytics] [services.googleAnalytics]
# Comment out the next line to disable GA tracking. Also disables the feature described in [params.ui.feedback]. # 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 # Language configuration

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

@ -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>
Loading…
Cancel
Save