diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d8d910f10..80fe0b4ae 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,17 +14,16 @@ jobs:
timeout-minutes: 15
steps:
- - name: All Branches - Git checkout, including recursive call for Docsy theme
+ - name: All Branches - Git checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- submodules: recursive # Fetch the Docsy theme
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- - name: All Branches - Install hugo extended v0.71.1
+ - name: All Branches - Install hugo extended v0.101.0
uses: peaceiris/actions-hugo@v2
with:
- hugo-version: "0.71.1"
+ hugo-version: "0.101.0"
extended: true
- name: All Branches - Install Node 12.x
diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml
index 89b63a783..e63870c13 100644
--- a/.github/workflows/daily.yml
+++ b/.github/workflows/daily.yml
@@ -20,16 +20,15 @@ jobs:
timeout-minutes: 15
steps:
- - name: All Branches - Git checkout, including recursive call for Docsy theme
+ - name: All Branches - Git checkout
uses: actions/checkout@v2
with:
- submodules: recursive # Fetch the Docsy theme
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- - name: All Branches - Install hugo extended v0.71.1
+ - name: All Branches - Install hugo extended v0.101.0
uses: peaceiris/actions-hugo@v2
with:
- hugo-version: "0.71.1"
+ hugo-version: "0.101.0"
extended: true
- name: All Branches - Install Node 12.x
diff --git a/.gitignore b/.gitignore
index 0b165cd5b..36fdfda29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,8 @@
public/
resources/
node_modules/
+# Ignore old theme submodule folder
+themes/
tech-doc-hugo
.DS_Store
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 92c7b2c63..000000000
--- a/.gitmodules
+++ /dev/null
@@ -1,4 +0,0 @@
-
-[submodule "themes/docsy"]
- path = themes/docsy
- url = https://github.com/google/docsy.git
diff --git a/README.md b/README.md
index 32a91ec0c..d0d703c3f 100644
--- a/README.md
+++ b/README.md
@@ -10,14 +10,12 @@ The documentation is built using Markdown pages, which can be converted into a n
## Installing Hugo
-The documentation site uses [Hugo](https://gohugo.io/), and specifically uses features found in the extended version of Hugo, v0.53 and later.
+The documentation site uses [Hugo](https://gohugo.io/), and specifically uses features found in the extended version of Hugo, v0.76.0 and later.
To install, follow the [installation instructions for your Operating System](https://gohugo.io/getting-started/installing/), and be sure to get the extended version.
## Building the Documentation
-1. Get local copies of the project submodules so you can build and run your site locally:
- - `git submodule update --init --recursive`
1. Build your site:
- `hugo server`
- If there are any errors, check that you have the latest version of Hugo, and are using the extended version.
@@ -42,3 +40,19 @@ _Note_: The `muffet.sh` script here is the identical script we run on GitHub. If
## Continuous Deployment
All changes to `main` branch run a [GitHub action](.github/workflows/ci.yml) to first check for any broken links ([per above](#link-checking-optional)) and then deploy to the documentation site: [docs.communityhealthtoolkit.org](https://docs.communityhealthtoolkit.org)
+
+## Upgrading dependencies
+
+### Hugo
+
+The version of Hugo used to deploy the site is specified in the [GitHub workflows config](./.github/workflows). To upgrade to a new version of Hugo, simply update the `hugo-version` property in the workflows to the desired version (after confirming the site functions properly on the new version of Hugo).
+
+_(Note there is also a minimum version of Hugo required to deploy the site specified via `module.hugoVersion` in the [`config.toml`](./config.toml) file.)_
+
+See the [Hugo Release Notes](https://github.com/gohugoio/hugo/releases) for documentation regarding what has changed in the new versions.
+
+### Docsy
+
+The current version of Docsy is pinned in the [`go.mod`](./go.mod) file. To upgrade to a new version of Docsy, use the `hugo mod get` command as described [in the Docsy documentation](https://www.docsy.dev/docs/updating/updating-hugo-module/).
+
+See the [Docsy CHANGELOG](https://github.com/google/docsy/blob/main/CHANGELOG.md) for documentation regarding what has changed in the new versions.
diff --git a/assets/scss/_variables_project.scss b/assets/scss/_variables_project.scss
index 502e51b11..cd8b6f74d 100644
--- a/assets/scss/_variables_project.scss
+++ b/assets/scss/_variables_project.scss
@@ -53,21 +53,21 @@ h2, h3 {
clear: both;
}
+#td-sidebar-menu {
+ .td-search-input {
+ max-width: none;
+ }
+}
+
+// https://github.com/medic/cht-docs/issues/212
#td-section-nav {
.td-sidebar-nav {
&__section {
- .show {
- padding-left: .5rem;
+ label {
+ padding-left: 0.7rem;
}
- ul {
- padding-left: 0;
- }
- }
-
- &__section-title {
- i {
- display: inline; // prevent widowed icon
- opacity: 0.5;
+ .without-child, .with-child {
+ padding-left: 0.5rem;
}
}
}
@@ -122,4 +122,4 @@ h2, h3 {
.fa-rotate-45 {
transform: rotate(45deg);
-}
\ No newline at end of file
+}
diff --git a/config.toml b/config.toml
index 3b99db4fb..d0fc30ca3 100644
--- a/config.toml
+++ b/config.toml
@@ -5,9 +5,6 @@ refLinksErrorLevel = "ERROR"
enableRobotsTXT = false
-# Hugo allows theme composition (and inheritance). The precedence is from left to right.
-theme = ["docsy"]
-
# Will give values to .Lastmod etc.
enableGitInfo = true
@@ -68,6 +65,20 @@ weight = 1
time_format_default = "02.01.2006"
time_format_blog = "02.01.2006"
+[module]
+ proxy = "direct"
+ # uncomment line below for temporary local development of module
+ # replacements = "github.com/google/docsy -> ../../docsy"
+ [module.hugoVersion]
+ extended = true
+ min = "0.76.0"
+ [[module.imports]]
+ path = "github.com/google/docsy"
+ disable = false
+ [[module.imports]]
+ path = "github.com/google/docsy/dependencies"
+ disable = false
+
[markup]
[markup.tableOfContents]
endLevel = 4
@@ -125,6 +136,8 @@ offlineSearch = false
[params.ui]
# Enable to show the side bar menu in its compact state.
sidebar_menu_compact = true
+# Enable folding sections of the sidebar
+sidebar_menu_foldable = true
# Set to true to disable breadcrumb navigation.
breadcrumb_disable = false
# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled)
diff --git a/content/en/_index.md b/content/en/_index.md
index 2f74d7c68..2bf8c8fc0 100644
--- a/content/en/_index.md
+++ b/content/en/_index.md
@@ -3,9 +3,19 @@ title: "Welcome to the Community Health Toolkit Docs Site!"
linkTitle: "Documentation"
identifier: "docs"
weight: 1
-menu:
-main:
-weight: 1
+cascade:
+- _target:
+ path: "/**"
+ kind: "page"
+ type: "docs"
+- _target:
+ path: "/**"
+ kind: "section"
+ type: "docs"
+- _target:
+ path: "/**"
+ kind: "section"
+ type: "home"
---
{{% pageinfo %}}
diff --git a/go.mod b/go.mod
new file mode 100644
index 000000000..3015e75a9
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,5 @@
+module github.com/medic/cht-docs
+
+go 1.13
+
+require github.com/google/docsy v0.4.0 // indirect
diff --git a/go.sum b/go.sum
new file mode 100644
index 000000000..d0073ccbe
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,5 @@
+github.com/FortAwesome/Font-Awesome v0.0.0-20210804190922-7d3d774145ac/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
+github.com/google/docsy v0.4.0 h1:Eyt2aiDC1fnw/Qq/9xnIqUU5n5Yyk4c8gX3nBDdTv/4=
+github.com/google/docsy v0.4.0/go.mod h1:vJjGkHNaw9bO42gpFTWwAUzHZWZEVlK46Kx7ikY5c7Y=
+github.com/google/docsy/dependencies v0.4.0/go.mod h1:2zZxHF+2qvkyXhLZtsbnqMotxMukJXLaf8fAZER48oo=
+github.com/twbs/bootstrap v4.6.1+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
deleted file mode 100644
index 0b59c7b72..000000000
--- a/layouts/_default/baseof.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{{/* Layout from docsy theme's /docs */}}
-
-
-
-{{ $editURL := printf "%s/edit/%s/content/%s" $gh_repo $gh_branch $pathFormatted }}
-{{ if and ($gh_subdir) (.Site.Language.Lang) }}
-{{ $editURL = printf "%s/edit/%s/%s/content/%s/%s" $gh_repo $gh_branch $gh_subdir ($.Site.Language.Lang) $pathFormatted }}
-{{ else if .Site.Language.Lang }}
-{{ $editURL = printf "%s/edit/%s/content/%s/%s" $gh_repo $gh_branch ($.Site.Language.Lang) $pathFormatted }}
-{{ else if $gh_subdir }}
-{{ $editURL = printf "%s/edit/%s/%s/content/%s" $gh_repo $gh_branch $gh_subdir $pathFormatted }}
-{{ end }}
-{{ $issuesURL := printf "%s/issues/new?title=Improve+'%s'&labels=enhancement&body=Page:+%s\nVersion:+%s\n---" $gh_repo (htmlEscape $.Title) (htmlEscape $.RelPermalink) (htmlEscape $.Lastmod) }}{{/* Only line modified from theme. */}}
- {{ T "post_edit_this" }}
- {{ T "post_create_issue" }}
-{{ if $gh_project_repo }}
-{{ $project_issueURL := printf "%s/issues/new" $gh_project_repo }}
- {{ T "post_create_project_issue" }}
-{{ end }}
+ {{ if $gh_url -}}
+ {{ warnf "Warning: use of `github_url` is deprecated. For details see https://www.docsy.dev/docs/adding-content/repository-links/#github_url-optional" -}}
+ {{ T "post_edit_this" }}
+ {{ else if $gh_repo -}}
+ {{ $gh_repo_path := printf "%s/content/%s" $gh_branch $pathFormatted -}}
+ {{ if and ($gh_subdir) (.Site.Language.Lang) -}}
+ {{ $gh_repo_path = printf "%s/%s/content/%s/%s" $gh_branch $gh_subdir ($.Site.Language.Lang) $pathFormatted -}}
+ {{ else if .Site.Language.Lang -}}
+ {{ $gh_repo_path = printf "%s/content/%s/%s" $gh_branch ($.Site.Language.Lang) $pathFormatted -}}
+ {{ else if $gh_subdir -}}
+ {{ $gh_repo_path = printf "%s/%s/content/%s" $gh_branch $gh_subdir $pathFormatted -}}
+ {{ end -}}
+
+ {{/* Adjust $gh_repo_path based on path_base_for_github_subdir */ -}}
+ {{ $ghs_base := $.Param "path_base_for_github_subdir" -}}
+ {{ $ghs_rename := "" -}}
+ {{ if reflect.IsMap $ghs_base -}}
+ {{ $ghs_rename = $ghs_base.to -}}
+ {{ $ghs_base = $ghs_base.from -}}
+ {{ end -}}
+ {{ with $ghs_base -}}
+ {{ $gh_repo_path = replaceRE . $ghs_rename $gh_repo_path -}}
+ {{ end -}}
+
+ {{ $viewURL := printf "%s/tree/%s" $gh_repo $gh_repo_path -}}
+ {{ $editURL := printf "%s/edit/%s" $gh_repo $gh_repo_path -}}
+
+ {{/*{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (safeURL $.Title ) -}}*/}}
+ {{ $issuesURL := printf "%s/issues/new?title=Improve+'%s'&labels=enhancement&body=Page:+%s\nVersion:+%s\n---" $gh_repo (htmlEscape $.Title) (htmlEscape $.RelPermalink) (htmlEscape $.Lastmod) }}
+ {{ $newPageStub := resources.Get "stubs/new-page-template.md" -}}
+ {{ $newPageQS := querify "value" $newPageStub.Content "filename" "change-me.md" | safeURL -}}
+ {{ $newPageURL := printf "%s/new/%s?%s" $gh_repo $gh_repo_path $newPageQS -}}
+
+
+ {{/* {{ T "post_view_this" }}*/}}
+ {{ T "post_edit_this" }}
+
+ {{/* {{ T "post_create_child_page" }}*/}}
+
+ {{/* {{ T "post_create_issue" }}*/}}
+ {{ T "post_create_issue" }}
+ {{ with $gh_project_repo -}}
+ {{ $project_issueURL := printf "%s/issues/new" . -}}
+ {{ T "post_create_project_issue" }}
+ {{ end -}}
+
+ {{ end -}}
+ {{ with .CurrentSection.AlternativeOutputFormats.Get "print" -}}
+ {{ T "print_entire_section" }}
+ {{ end }}
-{{ end }}
-{{ end }}
+{{ end -}}
diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html
index 374f6c6c0..3fffd0fa6 100644
--- a/layouts/partials/sidebar-tree.html
+++ b/layouts/partials/sidebar-tree.html
@@ -1,63 +1,81 @@
-{{/* Modified from docsy theme to hide root item, and to distinguish selected and active sections */}}
+
+
{{/* We cache this partial for bigger sites and set the active class client side. */}}
-{{ $shouldDelayActive := ge (len .Site.Pages) 2000 }}
+{{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 -}}
+{{ $shouldDelayActive := ge (len .Site.Pages) $sidebarCacheLimit -}}
- {{ if not .Site.Params.ui.sidebar_search_disable }}
-
- {{ end }}
-