Implement multi-domain SEO improvements:
- Add metadata to login and login-verify pages to prevent indexing. - Update robots.txt to disallow additional sensitive paths. - Enhance sitemap generation to filter by city and include accurate last modified dates. - Refactor canonical URL generation to support multi-domain architecture, ensuring self-canonicalization for city domains. - Remove deprecated CanonicalHandler component and streamline canonical URL handling. - Introduce safe JSON-LD output to prevent XSS vulnerabilities. - Add payment layout with appropriate metadata to prevent indexing. - Conduct a comprehensive technical SEO audit and implement necessary fixes across the application.
This commit is contained in:
+12
-5
@@ -1,11 +1,14 @@
|
||||
import { cache } from "react";
|
||||
import BlogPage from "@/components/blog";
|
||||
import Layout from "@/components/layout/StLayout";
|
||||
import { notFound } from "next/navigation";
|
||||
import { fetchReq } from "@/lib/req";
|
||||
import { getStateInfo } from "@/lib/getStateInfo";
|
||||
import { getRequestOrigin } from "@/lib/getCanonicalUrl";
|
||||
import { safeJsonLd } from "@/lib/sanitize";
|
||||
import { normalizeBlog, imageUrl } from "@/helper";
|
||||
|
||||
const FALLBACK_IMG = "https://www.nobat724.com/assets/images/logo.png";
|
||||
const FALLBACK_IMG = "https://nobat724.com/assets/images/logo.png";
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
const getBlog = cache(async (slug) => {
|
||||
@@ -40,6 +43,8 @@ export async function generateMetadata({ params }) {
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
// محتوای بلاگ روی همهی دامنههای شهری یکسان است — تجمیع اعتبار روی دامنهی اصلی
|
||||
alternates: { canonical: `https://nobat724.com/blog/${slug}` },
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
@@ -63,8 +68,10 @@ export async function generateMetadata({ params }) {
|
||||
|
||||
async function Blog({ params }) {
|
||||
const { slug } = await params;
|
||||
const origin = await getRequestOrigin();
|
||||
|
||||
const blog = normalizeBlog(await getBlog(slug));
|
||||
if (!blog) notFound();
|
||||
|
||||
let relatedBlogs = [];
|
||||
const relatedResponse = await fetchReq(
|
||||
@@ -93,8 +100,8 @@ async function Blog({ params }) {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
itemListElement: [
|
||||
{ "@type": "ListItem", position: 1, name: "خانه", item: "https://www.nobat724.com" },
|
||||
{ "@type": "ListItem", position: 2, name: "مقالات", item: "https://www.nobat724.com/blogs" },
|
||||
{ "@type": "ListItem", position: 1, name: "خانه", item: origin },
|
||||
{ "@type": "ListItem", position: 2, name: "مقالات", item: `${origin}/blogs` },
|
||||
{ "@type": "ListItem", position: 3, name: blog.title },
|
||||
],
|
||||
}
|
||||
@@ -105,13 +112,13 @@ async function Blog({ params }) {
|
||||
{jsonLd && (
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
|
||||
dangerouslySetInnerHTML={{ __html: safeJsonLd(jsonLd) }}
|
||||
/>
|
||||
)}
|
||||
{breadcrumbJsonLd && (
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbJsonLd) }}
|
||||
dangerouslySetInnerHTML={{ __html: safeJsonLd(breadcrumbJsonLd) }}
|
||||
/>
|
||||
)}
|
||||
<Layout>
|
||||
|
||||
Reference in New Issue
Block a user