Files
Montech_Landing/apps/landing/pages/blog/[slug].vue
T
MahdiandCursor c33a757af4 Sync admin settings and media with the public landing site.
Show logo in the navbar, add image upload fields for logo/team/work/blog/gallery, and drive site chrome from settings everywhere.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 22:10:45 +03:30

53 lines
1.7 KiB
Vue

<template>
<article v-if="post" class="min-h-screen px-6 pb-24 pt-28 md:px-10">
<SiteNavbar
:brand="chrome.brand"
:logo-url="chrome.logoUrl"
:timezone="chrome.timezone"
/>
<div class="mx-auto max-w-[760px]">
<NuxtLink to="/blog" class="text-sm text-ash hover:text-volt">→ بازگشت به بلاگ</NuxtLink>
<h1 class="mt-8 font-display text-3xl font-extrabold leading-tight md:text-5xl">
{{ post.title }}
</h1>
<p class="mt-4 text-sm text-ash">
{{ post.publishedAt ? new Date(post.publishedAt).toLocaleDateString("fa-IR") : "" }}
</p>
<div class="mt-10 whitespace-pre-line text-base leading-relaxed text-bone/90">{{ plainContent }}</div>
</div>
</article>
</template>
<script setup lang="ts">
const chrome = await useSiteChrome();
const route = useRoute();
const slug = String(route.params.slug);
const { data: post } = await useAsyncData(`blog-${slug}`, () => fetchPublicPost(slug), {
getCachedData: () => undefined,
});
if (!post.value) {
throw createError({ statusCode: 404, statusMessage: "پست پیدا نشد" });
}
const plainContent = computed(() => {
const raw = post.value?.content || "";
return raw
.replace(/<\/p>/gi, "\n\n")
.replace(/<br\s*\/?>/gi, "\n")
.replace(/<[^>]+>/g, "")
.trim();
});
useSeoMeta({
title: post.value.seoTitle || post.value.title,
description: post.value.seoDesc || post.value.excerpt,
ogTitle: post.value.seoTitle || post.value.title,
ogDescription: post.value.seoDesc || post.value.excerpt,
ogImage: post.value.ogImage || post.value.coverUrl || undefined,
});
if (post.value.canonical) {
useHead({ link: [{ rel: "canonical", href: post.value.canonical }] });
}
</script>