diff --git a/.github/workflows/github_pages.yml b/.github/workflows/github_pages.yml index 9abe9d54..2b38f3f3 100644 --- a/.github/workflows/github_pages.yml +++ b/.github/workflows/github_pages.yml @@ -32,7 +32,7 @@ jobs: - name: Build docs run: | - pip install gitpython packaging + pip install gitpython packaging toml python site/build_docs.py - name: Deploy diff --git a/site/assets/scss/_custom.scss b/site/assets/scss/_custom.scss index f8a370ef..95b55697 100644 --- a/site/assets/scss/_custom.scss +++ b/site/assets/scss/_custom.scss @@ -133,3 +133,17 @@ #td-cover-block-0 { background-image: url("../images/background-about-page.jpg"); } + +/* Display version menu on mobile version of the site */ + +#dropdown_ver { + right: 5px !important; + left: auto; +} + +@media (min-width: 991.98px) { + #dropdown_ver { + right: 245px !important; + left: auto; + } +} diff --git a/site/build_docs.py b/site/build_docs.py index 37232b8f..08128672 100644 --- a/site/build_docs.py +++ b/site/build_docs.py @@ -3,10 +3,12 @@ # SPDX-License-Identifier: MIT import os -from packaging import version +import shutil import subprocess +from packaging import version import git +import toml MINIMUM_VERSION='1.5.0' @@ -28,10 +30,25 @@ def generate_versioning_config(filename, versions, url_prefix=''): file_object.write('url = "{}"\n\n'.format(url)) with open(filename, 'w') as f: - write_version_item(f, 'develop', '{}/'.format(url_prefix)) + write_version_item(f, 'Latest version', '{}/'.format(url_prefix)) for v in versions: write_version_item(f, v, '{}/{}'.format(url_prefix, v)) +def git_checkout(tagname, cwd): + docs_dir = os.path.join(cwd, 'site', 'content', 'en', 'docs') + shutil.rmtree(docs_dir) + repo.git.checkout(tagname, '--', 'site/content/en/docs') + images_dir = os.path.join(cwd, 'site', 'content', 'en', 'images') + shutil.rmtree(images_dir) + repo.git.checkout(tagname, '--', 'site/content/en/images') + +def change_version_menu_toml(filename, version): + data = toml.load(filename) + data['params']['version_menu'] = version + + with open(filename,'w') as f: + toml.dump(data, f) + def generate_docs(repo, output_dir, tags): def run_hugo(content_loc, destination_dir): subprocess.run([ # nosec @@ -50,13 +67,14 @@ def generate_docs(repo, output_dir, tags): os.makedirs(output_dir) generate_versioning_config(os.path.join(cwd, 'site', 'versioning.toml'), (t.name for t in tags)) + change_version_menu_toml(os.path.join(cwd, 'site', 'versioning.toml'), 'Latest version') run_hugo(content_loc, output_dir) 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, '--', 'site/content/en/docs') - repo.git.checkout(tag.name, '--', 'site/content/en/images') + git_checkout(tag.name, cwd) destination_dir = os.path.join(output_dir, tag.name) + change_version_menu_toml(os.path.join(cwd, 'site', 'versioning.toml'), tag.name) os.makedirs(destination_dir) run_hugo(content_loc, destination_dir) diff --git a/site/config.toml b/site/config.toml index b9f6f7ac..fbd5ccfe 100644 --- a/site/config.toml +++ b/site/config.toml @@ -96,7 +96,7 @@ cvat_terms_of_use = "https://cvat.org/api/v1/restrictions/terms-of-use" # Menu title if your navbar has a versions selector to access old versions of your site. # This menu appears only if you have at least one [params.versions] set. -version_menu = "Releases" +# version_menu = "Releases" # Flag used in the "version-banner" partial to decide whether to display a # banner on every page indicating that this is an archived version of the docs. diff --git a/site/content/en/docs/administration/_index.md b/site/content/en/docs/administration/_index.md index 215c41aa..c3e09d42 100644 --- a/site/content/en/docs/administration/_index.md +++ b/site/content/en/docs/administration/_index.md @@ -1,9 +1,6 @@ --- - title: 'Administration' linkTitle: 'Administration' weight: 3 description: 'This section contains documents for system administrators.' -hide_feedback: true - --- diff --git a/site/content/en/docs/administration/advanced/_index.md b/site/content/en/docs/administration/advanced/_index.md index 8f1ad89b..93135df1 100644 --- a/site/content/en/docs/administration/advanced/_index.md +++ b/site/content/en/docs/administration/advanced/_index.md @@ -1,9 +1,6 @@ --- - title: 'Advanced' linkTitle: 'Advanced' weight: 2 description: 'This section contains advanced documents for system administrators.' -hide_feedback: true - --- diff --git a/site/content/en/docs/administration/basics/_index.md b/site/content/en/docs/administration/basics/_index.md index e156be79..f998efaa 100644 --- a/site/content/en/docs/administration/basics/_index.md +++ b/site/content/en/docs/administration/basics/_index.md @@ -1,9 +1,6 @@ --- - title: 'Basics' linkTitle: 'Basics' weight: 1 description: 'This section contains basic documents for system administrators.' -hide_feedback: true - --- diff --git a/site/content/en/docs/contributing/_index.md b/site/content/en/docs/contributing/_index.md index 180ebbce..bf75235b 100644 --- a/site/content/en/docs/contributing/_index.md +++ b/site/content/en/docs/contributing/_index.md @@ -3,8 +3,6 @@ title: 'Contributing to this project' linkTitle: 'Contributing' weight: 4 description: 'This section contains documents for CVAT developers.' -hide_feedback: true -ul_show: false --- Please take a moment to review this document in order to make the contribution diff --git a/site/content/en/docs/manual/_index.md b/site/content/en/docs/manual/_index.md index 611d71ab..c0b2ded5 100644 --- a/site/content/en/docs/manual/_index.md +++ b/site/content/en/docs/manual/_index.md @@ -1,9 +1,6 @@ --- - title: 'Manual' linkTitle: 'Manual' weight: 2 description: 'This section contains documents for CVAT simple and advanced users' -hide_feedback: true - --- diff --git a/site/content/en/docs/manual/advanced/_index.md b/site/content/en/docs/manual/advanced/_index.md index 42c8c55a..9c74f156 100644 --- a/site/content/en/docs/manual/advanced/_index.md +++ b/site/content/en/docs/manual/advanced/_index.md @@ -3,6 +3,4 @@ title: "Advanced" linkTitle: "Advanced" weight: 2 description: 'This section contains advanced documents for CVAT users' -hide_feedback: true - --- diff --git a/site/content/en/docs/manual/basics/_index.md b/site/content/en/docs/manual/basics/_index.md index 41121d0b..d03b623f 100644 --- a/site/content/en/docs/manual/basics/_index.md +++ b/site/content/en/docs/manual/basics/_index.md @@ -3,6 +3,4 @@ title: "Basics" linkTitle: "Basics" weight: 1 description: 'This section contains basic documents for CVAT users' -hide_feedback: true - --- diff --git a/site/content/en/page_404.html b/site/content/en/page_404.html new file mode 100644 index 00000000..60b3e60d --- /dev/null +++ b/site/content/en/page_404.html @@ -0,0 +1,11 @@ ++++ +Title = 404 ++++ + +
+
+

404

+

Not found

+

Oops! This page doesn't exist. Try going back to our about page or documentation page.

+
+
diff --git a/site/i18n/en.toml b/site/i18n/en.toml index cb22ca31..575945e1 100644 --- a/site/i18n/en.toml +++ b/site/i18n/en.toml @@ -1,23 +1,3 @@ - - -# UI strings. Buttons and similar. - -[ui_pager_prev] -other = "Previous" - -[ui_pager_next] -other = "Next" - -[ui_read_more] -other = "Read more" - -[ui_search] -other = "Search this site…" - -# Used in sentences such as "Posted in News" -[ui_in] -other = "in" - # Footer text [footer_intel_privacy_notice] other = "Privacy Policy" @@ -33,31 +13,3 @@ other = "Notices and Disclaimers" [footer_human_rights_principles] other = "Human Rights Principles" - -# Post (blog, articles etc.) -[post_byline_by] -other = "By" -[post_created] -other = "Created" -[post_last_mod] -other = "Last modified" -[post_edit_this] -other = "Edit this page" -[post_create_child_page] -other = "Create child page" -[post_create_issue] -other = "Create documentation issue" -[post_create_project_issue] -other = "Create project issue" -[post_posts_in] -other = "Posts in" - -# Print support -[print_printable_section] -other = "This the multi-page printable view of this section." -[print_click_to_print] -other = "Click here to print" -[print_show_regular] -other = "Return to the regular view of this page" -[print_entire_section] -other = "Print entire section" diff --git a/site/layouts/404.html b/site/layouts/404.html index 55f504f0..2a8e27bf 100644 --- a/site/layouts/404.html +++ b/site/layouts/404.html @@ -1,9 +1 @@ -{{ define "main"}} -
-
-

404

-

Not found

-

Oops! This page doesn't exist. Try going back to our about page or documentation page.

-
-
-{{ end }} + diff --git a/site/layouts/partials/navbar-version-selector.html b/site/layouts/partials/navbar-version-selector.html deleted file mode 100644 index 619ca172..00000000 --- a/site/layouts/partials/navbar-version-selector.html +++ /dev/null @@ -1,11 +0,0 @@ -{{ $page_rel := .Page.RelPermalink | safeURL }} -{{ $page_rel_trim := strings.TrimLeft "/" $page_rel | safeURL }} - - diff --git a/site/layouts/partials/navbar.html b/site/layouts/partials/navbar.html index d8b5d580..c1233138 100644 --- a/site/layouts/partials/navbar.html +++ b/site/layouts/partials/navbar.html @@ -1,4 +1,6 @@ {{ $cover := .HasShortcode "blocks/cover" }} +{{ $page_rel := .Page.RelPermalink | safeURL }} +{{ $page_rel_trim := strings.TrimLeft "/" $page_rel | safeURL }}