|
| 1 | +--- |
| 2 | +argument-hint: [title] |
| 3 | +description: Create a new blog post in the feed |
| 4 | +--- |
| 5 | + |
| 6 | +Create a new blog post with the following specifications: |
| 7 | + |
| 8 | +**Title**: $REMAINING_ARGS (all arguments) |
| 9 | + |
| 10 | +If no title is provided, prompt the user for a title interactively. |
| 11 | + |
| 12 | +**Steps to create the blog post:** |
| 13 | + |
| 14 | +1. Get the current date and time with `-07:00` timezone offset by running: |
| 15 | + |
| 16 | + ```bash |
| 17 | + TZ=America/Phoenix date +"%Y-%m-%d %H:%M:%S -07:00" |
| 18 | + ``` |
| 19 | + |
| 20 | +2. If no title was provided, ask the user: "What is the title for this blog post?" |
| 21 | + |
| 22 | +3. Generate a slugified directory name from the title: |
| 23 | + |
| 24 | + - Convert to lowercase |
| 25 | + - Replace spaces with hyphens |
| 26 | + - Remove special characters (keep only alphanumeric and hyphens) |
| 27 | + - Example: "My Great Post!" → "my-great-post" |
| 28 | + |
| 29 | +4. Create the directory at: `www/feed/<slugified-title>/` |
| 30 | + |
| 31 | +5. Create the file at: `www/feed/<slugified-title>/index.md` |
| 32 | + |
| 33 | +6. Populate the file with this frontmatter structure: |
| 34 | + |
| 35 | + ```yaml |
| 36 | + --- |
| 37 | + tags: |
| 38 | + - article |
| 39 | + layout: article |
| 40 | + author: eric |
| 41 | + title: <user-provided title> |
| 42 | + date: <datetime from step 1> |
| 43 | + teaser: >- |
| 44 | + <prompt user: "What is the teaser for this blog post?"> |
| 45 | + --- |
| 46 | + ``` |
| 47 | + |
| 48 | +7. After the frontmatter, add a blank line and a comment: |
| 49 | + |
| 50 | + ```markdown |
| 51 | + <!-- Write your blog post content here --> |
| 52 | + ``` |
| 53 | + |
| 54 | +8. Open the newly created file in the editor for the user to start writing. |
| 55 | + |
| 56 | +**Important notes:** |
| 57 | + |
| 58 | +- Each blog post gets its own directory under `www/feed/` |
| 59 | +- The main content file is always named `index.md` |
| 60 | +- The date MUST include the full timestamp with time, not just the date |
| 61 | +- Always use the `-07:00` timezone offset |
| 62 | +- The default layout is `article` but can be changed later if needed (e.g., `video`) |
| 63 | +- Additional frontmatter fields can be added later (e.g., `subhead`, `image`) |
0 commit comments