blog-backup/docs/TITLE_FORMAT.md

71 lines
2.2 KiB
Markdown

# Daily Digest Title Format Standard
## Standard Format
All Daily Digest titles must follow this exact format:
```
## Daily Digest - {DayName}, {Month} {Day}, {Year}
```
### Examples
**Correct:**
- `## Daily Digest - Monday, February 24, 2026`
- `## Daily Digest - Tuesday, March 3, 2026`
- `## Daily Digest - Sunday, December 31, 2026`
**Incorrect:**
- `## Daily Digest - February 24, 2026` (missing day name)
- `## Daily Digest - Monday, February 24th, 2026` (uses ordinal "24th")
- `# Daily Digest - Monday, February 24, 2026` (wrong header level)
## Rules
1. **Header Level:** Always use `##` (H2), not `#` (H1) or `###` (H3)
2. **Day Name:** Always include the full day name (Monday, Tuesday, etc.)
3. **Month:** Full month name (January, February, etc.)
4. **Day:** Plain number without ordinal suffix (24, not 24th)
5. **Year:** Full 4-digit year (2026, not 26)
6. **Separators:** Comma after day name, comma after day number
## Code Reference
If you need to generate a title programmatically, use this function:
```typescript
function getDayName(dateStr: string): string {
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const date = new Date(dateStr + 'T12:00:00'); // Use noon to avoid timezone issues
return days[date.getDay()];
}
function formatDateForTitle(dateStr: string): string {
const months = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
];
const [year, month, day] = dateStr.split('-');
const monthName = months[parseInt(month, 10) - 1];
return `${monthName} ${parseInt(day, 10)}, ${year}`;
}
function generateStandardTitle(dateStr: string): string {
const dayName = getDayName(dateStr);
const datePart = formatDateForTitle(dateStr);
return `## Daily Digest - ${dayName}, ${datePart}`;
}
// Example usage:
const title = generateStandardTitle('2026-02-24');
// Returns: "## Daily Digest - Tuesday, February 24, 2026"
```
## Migration History
**Last Migration:** 2026-02-24
- Migrated 9 existing posts to the new standard format
- Script: `scripts/migrate-titles.js`
- Run with: `node scripts/migrate-titles.js`
- Dry run: `node scripts/migrate-titles.js --dry-run`