| 1 |
{{/* |
| 2 |
We use the front matter keywords field to determine related content. To ensure |
| 3 |
consistency, during site build we validate each keyword against the entries in |
| 4 |
data/keywords.yaml. |
| 5 |
|
| 6 |
As of March 5, 2025, this feature is experimental, pending usability |
| 7 |
assessment. We anticipate that the number of additions to data/keywords.yaml |
| 8 |
will decrease over time, though the initial implementation will require some |
| 9 |
effort. |
| 10 |
*/}} |
| 11 |
|
| 12 |
{{- $t := debug.Timer "validateKeywords" }} |
| 13 |
{{- $allowedKeywords := collections.Apply hugo.Data.keywords "strings.ToLower" "." }} |
| 14 |
{{- range $p := site.Pages }} |
| 15 |
{{- range .Params.keywords }} |
| 16 |
{{- if not (in $allowedKeywords (lower .)) }} |
| 17 |
{{- warnf "The word or phrase %q is not in the keywords data file. See %s." . $p.Page.String }} |
| 18 |
{{- end }} |
| 19 |
{{- end }} |
| 20 |
{{- end }} |
| 21 |
{{- $t.Stop }} |