|
| 1 | +--- |
| 2 | +name: draft-learning-path |
| 3 | +description: "Toggle draft mode on a Learning Path _index.md. Use when: marking a learning path as draft, hiding a learning path from publication, adding draft: true to front matter, unpublishing or disabling a learning path, removing draft, publishing a learning path, taking a learning path out of draft." |
| 4 | +--- |
| 5 | + |
| 6 | +# Draft Learning Path |
| 7 | + |
| 8 | +Sets `draft: true` and `cascade: draft: true` in the front matter of a Learning Path `_index.md` file so the page and all its child pages are excluded from the published site. |
| 9 | + |
| 10 | +For new content intake where the goal is to prevent unreviewed content from publishing, use `.github/skills/intake-metadata-update/SKILL.md` instead. |
| 11 | + |
| 12 | +## Draft block to insert |
| 13 | + |
| 14 | +The following YAML must be added to the front matter, after the `title:` field. Leave a blank line between `title:` and the draft block for readability: |
| 15 | + |
| 16 | +```yaml |
| 17 | +title: Your Learning Path Title |
| 18 | + |
| 19 | +draft: true |
| 20 | +cascade: |
| 21 | + draft: true |
| 22 | +``` |
| 23 | +
|
| 24 | +## Workflow |
| 25 | +
|
| 26 | +1. **Identify the target file** |
| 27 | + - If the user specifies a path, use that. |
| 28 | + - Otherwise, use the currently open or most recently edited `_index.md` file in the workspace. |
| 29 | + - Confirm the file is a Learning Path `_index.md` (contains Hugo front matter between `---` markers). |
| 30 | + |
| 31 | +2. **Read the file** |
| 32 | + - Read the file to inspect the existing front matter. |
| 33 | + |
| 34 | +3. **Apply the draft block** |
| 35 | + - If `draft: true` and `cascade:` with `draft: true` already exist, inform the user it is already in draft mode and stop. |
| 36 | + - If a `draft:` field exists but no `cascade:` block, replace the existing `draft:` line with the full draft block above. |
| 37 | + - If no `draft:` field exists, insert the draft block after the `title:` field, with a blank line between them. |
| 38 | + |
| 39 | +4. **Confirm** |
| 40 | + - Report the file path and confirm the draft block has been set. |
| 41 | + - Remind the user that Hugo will exclude this file and all child pages from the built site until the draft block is removed. |
| 42 | + |
| 43 | +## Undraft workflow |
| 44 | + |
| 45 | +If the user asks to publish, undraft, or remove draft mode: |
| 46 | + |
| 47 | +1. **Identify the target file** (same as above). |
| 48 | +2. **Read the file** to locate the draft block. |
| 49 | +3. **Remove the draft block** |
| 50 | + - Remove the `draft: true` line. |
| 51 | + - Remove the `cascade:` block (`cascade:` and its indented `draft: true` child line). |
| 52 | + - Remove any blank line that was added between `title:` and the draft block, restoring the original spacing. |
| 53 | + - If no draft block exists, inform the user the file is already published and stop. |
| 54 | +4. **Confirm** |
| 55 | + - Report the file path and confirm draft mode has been removed. |
| 56 | + - Remind the user the Learning Path will now appear on the published site. |
0 commit comments