Skip to content

Commit

Permalink
Add target for detecting broken links in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigc committed Jun 12, 2023
1 parent 2c513b5 commit a3396c4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 23 deletions.
24 changes: 1 addition & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,26 +162,4 @@ To make sure its copy of CRDs is up-to-date, please, run `make all`.
All documentation is stored under docs, for our homepage we are using hugo and the [docsy theme](https://github.com/google/docsy).

If you don't feel the needs to preview the changes that you have done to the docs all you need to do is to edit them.
But if you want to see how your changes will look you need to install hugo locally.

### Hugo

When installing hugo install the `extended` edition, you can easily find it on there github page.
We are currently using [0.111.2](https://github.com/gohugoio/hugo/releases/tag/v0.111.2) but it probably works with other versions as well.

To develop locally you need to also follow the docsy [pre-req](https://github.com/google/docsy#prerequisites).
But in most cases it should work to just run

```shell
cd hugo
# Install npm dependencies
npm ci
# Download hugo module
hugo mod get
```

To look at your changes with hot reload.

```shell
hugo serve
```
But if you want to see how your changes will look you need to install hugo locally, see [Hugo ](./hugo/README.md)
12 changes: 12 additions & 0 deletions hugo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

DOCS_URL ?= http//localhost:1313

.PHONY: detect-broken-links
detect-broken-links:
go install github.com/raviqqe/muffet/v2@latest
muffet --rate-limit=3 --max-connections=2 --buffer-size=8192 http://localhost:1313

34 changes: 34 additions & 0 deletions hugo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Hugo

## Installing and running Hugo

When installing hugo install the `extended` edition, you can easily find it on there github page.
We are currently using [0.111.2](https://github.com/gohugoio/hugo/releases/tag/v0.111.2) but it probably works with other versions as well.

To develop locally you need to also follow the docsy [pre-req](https://github.com/google/docsy#prerequisites).
But in most cases it should work to just run

```shell
cd hugo
# Install npm dependencies
npm ci
# Download hugo module
hugo mod get
```

To look at your changes with hot reload.

```shell
hugo serve
```

## Detecting broken links in documentation

To detect broken links in documentation using [muffet](https://github.com/raviqqe/muffet):

1. Make sure that hugo is running and serving documentation as specified in the abbove steps.
2. Run the following command in the hugo directory:

```shell
make detect-broken-links
```

0 comments on commit a3396c4

Please sign in to comment.