Fix: Blog URLs and remove duplicate AI Automation links

Fixes:
1. Blog URLs now correct (without .md extension)
   - Changed from: /blog/core-web-vitals.md/
   - Changed to: /blog/core-web-vitals/
2. Fixed duplicate AI Automation in navigation
   - Removed duplicate from header submenu
   - Removed duplicate from mobile menu
   - Removed duplicate from footer
   - Now 4 unique services in all menus

Blog:
- getStaticPaths: slug.replace('.md', '')
- blog/index.astro: links use slug.replace('.md', '')
- Blog builds to correct URLs without .md

Navigation:
- Header submenu: 4 services (not 5)
- Mobile menu: 4 services (not 5)
- Footer: 4 services (was 5 with duplicate)

Services (4 unique):
1. พัฒนาเว็บไซต์
2. AI Automation
3. พัฒนาแอปพลิเคชัน
4. ที่ปรึกษาการตลาดออนไลน์
This commit is contained in:
Kunthawat Greethong
2026-03-05 00:28:54 +07:00
parent b92ebb4690
commit a57df0d6c8
3 changed files with 12 additions and 18 deletions

View File

@@ -5,7 +5,7 @@ import { getCollection } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map((post) => ({
params: { slug: post.id },
params: { slug: post.id.replace('.md', '') },
props: { post },
}));
}

View File

@@ -26,14 +26,14 @@ posts.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
))}
</div>
<h2 class="text-xl font-bold mb-3 hover:text-accent-blue transition">
<a href={`/blog/${post.id}/`} class="hover:underline">{post.data.title}</a>
<a href={`/blog/${post.id.replace('.md', '')}/`} class="hover:underline">{post.data.title}</a>
</h2>
<p class="text-gray-600 mb-4 line-clamp-3">{post.data.description}</p>
<div class="flex items-center justify-between text-sm text-gray-500">
<span>{post.data.author}</span>
<span>{post.data.pubDate.toLocaleDateString('th-TH')}</span>
</div>
<a href={`/blog/${post.id}/`} class="text-accent-blue font-medium hover:underline flex items-center gap-2 mt-4">อ่านเพิ่มเติม →</a>
<a href={`/blog/${post.id.replace('.md', '')}/`} class="text-accent-blue font-medium hover:underline flex items-center gap-2 mt-4">อ่านเพิ่มเติม →</a>
</div>
</article>
))}