c5e0b009ca
- Tailwind v4 via @tailwindcss/vite + typography plugin - astro-icon (Tabler), self-hosted Rubik/Inter, RSS, Pagefind postbuild - Prettier (astro + tailwind plugins), editorconfig - new:post script with Turkish-aware slugify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
// Usage: npm run new:post -- "Yazı Başlığı"
|
||
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
||
import { join } from 'node:path';
|
||
import { slugify } from '../src/lib/slug.ts';
|
||
|
||
const title = process.argv.slice(2).join(' ').trim();
|
||
if (!title) {
|
||
console.error('Kullanım: npm run new:post -- "Yazı Başlığı"');
|
||
process.exit(1);
|
||
}
|
||
|
||
const slug = slugify(title);
|
||
const dir = join('src', 'content', 'blog', slug);
|
||
if (existsSync(dir)) {
|
||
console.error(`Zaten var: ${dir}`);
|
||
process.exit(1);
|
||
}
|
||
|
||
const today = new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Istanbul' }).format(new Date());
|
||
const body = `---
|
||
title: ${JSON.stringify(title)}
|
||
description: "Arama sonuçlarında görünecek 120–155 karakterlik açıklama."
|
||
pubDate: ${today}
|
||
# updatedDate: ${today}
|
||
category: "genel"
|
||
tags: []
|
||
# cover: "./kapak.jpg"
|
||
# coverAlt: "Kapak görselinin anlamlı açıklaması"
|
||
featured: false
|
||
diy: false
|
||
draft: true
|
||
---
|
||
|
||
Giriş paragrafı: yazının neyi anlattığını ve okuyucunun ne kazanacağını 2–3 cümlede söyle.
|
||
|
||
## Birinci Bölüm
|
||
|
||
Metin…
|
||
|
||
## Sonuç
|
||
|
||
Kısa özet ve varsa sonraki adımlar.
|
||
|
||
73 de TA1SPH
|
||
`;
|
||
|
||
mkdirSync(dir, { recursive: true });
|
||
writeFileSync(join(dir, 'index.md'), body);
|
||
console.log(`Oluşturuldu: ${join(dir, 'index.md')} (draft: true)`);
|