Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,14 @@ Supported `validationMode` values:
- `off` suppresses content health warnings and skips registry lookups.

Registry lookups are scoped to root learning paths, challenges, and
certifications. Draft root content is not warning-producing and is hidden from
the Instructor Toolkit report. Nested course/module/page/test IDs are not
checked against the Cloud curriculum registry.
certifications. Nested course/module/page/test IDs are not checked against the
Cloud curriculum registry.

Validation respects the build's draft mode. Draft root content is only
validated when the build actually renders it (`hugo --buildDrafts`); those
drafts are checked softly and never block publishing. When draft mode is off,
draft root content is not part of the build and is skipped entirely — it is
neither checked against the registry nor reported as warnings.

If `params.academy.registryURL` is not configured, the build prints one
configuration warning and does not report existing IDs as invalid because they
Expand Down
19 changes: 16 additions & 3 deletions layouts/partials/academy-validation/collect-content-health.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@
{{- $fix := "" -}}
{{- $registryStatus := "" -}}
{{- $cloudStatus := "" -}}
{{- $isDraft := or .Draft (eq (printf "%v" .Params.draft | lower) "true") -}}
{{- /* .Draft is Hugo's build-aware draft state: a page only carries it inside
$site.Pages when the build itself rendered drafts (hugo --buildDrafts).
Treat that as "draft mode on" for this content and validate it softly below.
$isDraft additionally covers content marked draft in front matter on disk;
when such content is not being built it is skipped rather than validated. */ -}}
{{- $draftBuilt := .Draft -}}
{{- $isDraft := $draftBuilt -}}
{{- if not $isDraft -}}
{{- $sourcePath := printf "content/%s" $filePath -}}
{{- $source := try (os.ReadFile $sourcePath) -}}
Expand All @@ -85,7 +91,14 @@
{{- $draft = add $draft 1 -}}
{{- end -}}

{{- if not (partial "academy-validation/validate-academy-org-id.html" $orgID) -}}
{{- if and $isDraft (not $draftBuilt) -}}
{{- /* Content is marked draft but the build's draft mode is off (Hugo is not
rendering it). Respect the build mode and skip validation entirely so we
never check or warn on draft modules that are not part of this build. */ -}}
{{- $status = "draft" -}}
{{- $issue = "Draft content is not validated while the build's draft mode is off." -}}
{{- $fix = "Build with drafts enabled (--buildDrafts) to validate this draft, or publish it." -}}
{{- else if not (partial "academy-validation/validate-academy-org-id.html" $orgID) -}}
{{- $status = "broken" -}}
{{- $issue = "Content is outside a valid organization directory." -}}
{{- $fix = "Move this root content under content/<type>/<org-id>/<slug>/." -}}
Expand Down Expand Up @@ -117,7 +130,7 @@
{{- end -}}
{{- end -}}

{{- if and $isDraft (ne $status "good") -}}
{{- if and $draftBuilt (ne $status "good") -}}
{{- $status = "draft_warning" -}}
{{- if eq $issue "" -}}
{{- $issue = "Draft content could not be fully validated." -}}
Expand Down
2 changes: 2 additions & 0 deletions layouts/shortcodes/instructor-toolkit.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
{{- else if eq .status "unchecked" -}}
Not checked
{{- else if eq .status "draft" -}}
Draft
{{- else -}}
{{- if ne $consoleURL "" -}}<a href="{{ $consoleURL }}" target="_blank" rel="noopener" aria-label="Open Instructor Console">❌</a>{{- else -}}❌{{- end -}}
{{- end -}}
Expand Down
Loading