feat: implement programmatic SEO solutions hub
- Add /solutions hub page with 10 category cards - Add /solutions/by-concern directory page - Add /solutions/by-oil directory page - Add Solutions section to Footer with navigation links - Add Breadcrumb component for solution pages - Add translations for all solution pages (sr, en, de, fr) - Fix ExitIntentDetector JSON parsing error - Update sitemap with solution pages - Create 3 sample solution pages with data files
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { MetadataRoute } from "next";
|
||||
import { getProducts, filterOutBundles } from "@/lib/saleor";
|
||||
import { getAllOilForConcernPages } from "@/lib/programmatic-seo/dataLoader";
|
||||
import { SUPPORTED_LOCALES, type Locale } from "@/lib/i18n/locales";
|
||||
|
||||
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://manoonoils.com";
|
||||
@@ -105,5 +106,35 @@ export default async function sitemap(): Promise<SitemapEntry[]> {
|
||||
}
|
||||
}
|
||||
|
||||
return [...staticPages, ...productUrls];
|
||||
let solutionPages: any[] = [];
|
||||
try {
|
||||
solutionPages = await getAllOilForConcernPages();
|
||||
} catch (e) {
|
||||
console.log("Failed to fetch solution pages for sitemap during build");
|
||||
}
|
||||
|
||||
const solutionUrls: SitemapEntry[] = [];
|
||||
|
||||
for (const page of solutionPages) {
|
||||
const hreflangs: Record<string, string> = {};
|
||||
for (const locale of SUPPORTED_LOCALES) {
|
||||
const path = locale === "sr" ? `/solutions/${page.slug}` : `/${locale}/solutions/${page.slug}`;
|
||||
hreflangs[locale] = `${baseUrl}${path}`;
|
||||
}
|
||||
|
||||
for (const locale of SUPPORTED_LOCALES) {
|
||||
const localePrefix = locale === "sr" ? "" : `/${locale}`;
|
||||
solutionUrls.push({
|
||||
url: `${baseUrl}${localePrefix}/solutions/${page.slug}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: "monthly",
|
||||
priority: 0.7,
|
||||
alternates: {
|
||||
languages: hreflangs,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return [...staticPages, ...productUrls, ...solutionUrls];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user