This repo contains documentation for the Community Health Toolkit (CHT), including how to build digital health applications with CHT Core. This repository powers the CHT documentation site at docs.communityhealthtoolkit.org.
The documentation is built using Markdown pages, which can be converted into a navigable website using a static-site-generator. The Hugo static-site-generator is being used with the Hextra theme. To maintain portability, content should be written in plain Markdown with limited use of HTML, custom shortcodes, and modifications to the theme. Contributions should align with the documentation style guide.
The documentation site uses Hugo including the extended version of Hugo (see .tool-versions file for specific version).
To proceed, choose one of the three options below of Docker, native packages or using asdf then proceed to "Run Hugo" below to start your local instance.
For folks using asdf and native packages, be sure the correct hugo version is installed per .tool-versions file.
Running hugo locally using Docker is likely the easiest way to update the docs. You only need to ensure you have Docker and Docker compose installed.
The steps below will leave a hugo container on your system. If you're not going to edit docs for the foreseeable future, you can delete it with docker rm cht-hugo .
If you'd like to install packages directly on your workstation, follow the installation instructions for your Operating System, and be sure to get the extended version. Most users will be able to simply install using their native package manager like brew, apt or snap.
asdf is another way to manage hugo and golang versions for local development.
After installing asdf, run:
asdf plugin add golang
asdf plugin add hugoYou can start your local CHT Docs instance by:
- Clone the
cht-docsrepo - From the command line, navigate to the local directory where you cloned the repo
- To start
hugorun:hugo serverforasdfand native packages ORdocker compose upfor Docker compose
- Preview your site in your browser at: http://localhost:1313/
- As you make changes to the site, your browser will automatically reload your changes.
Any users who experience errors running hugo server, please see our Troubleshooting guide.
We have two types of link checking:
- All links - tests all links within docs and outbound
- Internal links - takes all internal links from production site and tests them on your branch
We validate that all links on the docs site work (do not 404) using a tool called Muffet along with Actions. If you're creating a lot of new links, or editing a lot of existing links, you may optionally run Muffet locally before pushing your commits. Running Muffet locally can save time by exposing broken links before pushing a build since you can avoid waiting for the Action to run, finding you have a broken link, fixing it, and pushing a new change.
- Start the docker container:
docker compose up -d - Test the links with the
muffet.shscript:docker exec cht-hugo sh -c "cd .github/scripts/; ./muffet.sh"
It can take many minutes depending on your Internet connection. If Muffet returns no output, you have no broken links, congrats!
Note
The muffet.sh script here is the identical script we run on GitHub. If you simply run muffet http://localhost:1313 you will hit GitHub's rate limiting and get lots of 429's. Our script intentionally reduces concurrency and excludes some repetitive GitHub URLs.
Note that you may see transient errors as shown here with lookup errors:
$ docker exec cht-hugo sh -c "cd .github/scripts/; ./muffet.sh"
http://localhost:1313/hosting/4.x/production/docker/adding-tls-certificates/
lookup letsencrypt.org: i/o timeout https://letsencrypt.org/
http://localhost:1313/technical-overview/concepts/offline-first/
lookup blog.couchdb.org: i/o timeout https://blog.couchdb.org/2017/09/19/couchdb-takes-medic-mobile-to-the-front-lines-of-healthcare-work/
http://localhost:1313/hosting/monitoring/production/
lookup letsencrypt.org: i/o timeout https://letsencrypt.org/
http://localhost:1313/building/forms/app/
lookup www.w3.org: i/o timeout https://www.w3.org/TR/1999/REC-xpath-19991116/ If you're moving more than ~5 pages around, you should check that they either correctly redirect with the aliases feature or 404 if the page is indeed removed with no replacement. There's a script that will get all the URLs from the production site and then check your branch for the result of every URL. If it gets a 200 with no redirect, nothing is shown. All other results, like 404 or a 200 which results in a redirect are shown.
This is mainly to help preserve SEO and to help folks who bookmark specific pages.
- Make your changes, for example moving 10s of pages to a new location
- Check that
hugocompiles and doesn't complain of any broken links - Start the docker container:
docker compose up -d - Test the links with the bash script:
docker exec cht-hugo .github/scripts/check.urls.sh
$ docker exec cht-hugo .github/scripts/check.urls.sh
Are you on a test branch and is hugo running on http://localhost:1313 ?
Fetching URLs from production.
Checking 435 URLs, be patient. Any non 200 URLs will be listed here:
Successfully checked 435 URLs!All changes to main branch run a GitHub action to first check for any broken links (per above) and then deploy to the documentation site: docs.communityhealthtoolkit.org
The version of Hugo used to deploy the site is specified in .tool-versions.
Note
Note there is also a minimum version of Hugo required to deploy the site specified via module.hugoVersion in the hugo.toml file.
See the Hugo Release Notes for documentation regarding what has changed in the new versions.
The current version of Hextra is pinned in the go.mod file. See the Hextra Releases for documentation regarding what has changed in the new versions.