130 lines
6.4 KiB
JavaScript
130 lines
6.4 KiB
JavaScript
import fs from "fs";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const mainDirectory = 'https://www.pozo.app';
|
|
|
|
const routes = [
|
|
{ path: "index.html", pageId: 1, url: `${mainDirectory}/`},
|
|
{ path: "signin/index.html", pageId: 2, url: `${mainDirectory}/signin` },
|
|
{ path: "pricing/index.html", pageId: 3, url: `${mainDirectory}/pricing` },
|
|
{ path: "contact-us/index.html", pageId: 4, url: `${mainDirectory}/contact-us` },
|
|
{ path: "blog/index.html", pageId: 5, url: `${mainDirectory}/blog` },
|
|
{ path: "about-us/index.html", pageId: 6, url: `${mainDirectory}/about-us` },
|
|
{ path: "solutions/index.html", pageId: 9, url: `${mainDirectory}/solutions` },
|
|
];
|
|
|
|
const seoData = {
|
|
1: {
|
|
title: "Retail ERP & POS for Indian MSMEs | POZO",
|
|
description: "Fast billing, smart inventory, GST-ready POS. POZO helps kirana, mini-supermarkets & retail chains speed checkout, connect weighing scales, and manage multi-store ops.",
|
|
keywords: "retail ERP, POS software, billing software, inventory management, GST billing, kirana store, mini supermarket, weighing scale POS, multi-store ERP, Indian retail software",
|
|
image: `${mainDirectory}/og/home.jpg`,
|
|
},
|
|
2: {
|
|
title: "Sign In to PozoApp | Retail ERP & POS Login",
|
|
description: "Access your business dashboard. Sign in to POZO retail ERP & POS system for billing, inventory management, and business analytics.",
|
|
keywords: "POZO login, retail ERP login, POS software login, business dashboard, billing software access, inventory management login",
|
|
image: `${mainDirectory}/og/Signin-og.jpg`,
|
|
},
|
|
3: {
|
|
title: "Pricing - Retail ERP & POS Plans | POZO",
|
|
description: "Simple plans for MSMEs. Fast billing, inventory, GST e-invoice, weighing-scale integration, WhatsApp e-bills & multi-store controls. Book a demo.",
|
|
keywords: "POZO pricing, retail ERP pricing, POS software cost, billing software price, inventory management pricing, GST software cost, MSME software pricing",
|
|
image: `${mainDirectory}/og/pricing-og.jpg`,
|
|
},
|
|
4: {
|
|
title: "Contact POZO | Retail ERP & POS Support",
|
|
description: "Get support and sales information for POZO retail ERP & POS solutions. Contact us for billing software, inventory management, and business automation.",
|
|
keywords: "POZO contact, retail ERP support, POS software support, billing software help, inventory management support, customer service, technical support",
|
|
image: `${mainDirectory}/og/contact-og.jpg`,
|
|
},
|
|
5: {
|
|
title: "POZO Blog — Retail ERP, POS & Grocery Billing Guides",
|
|
description: "Practical guides on POS billing, weighing-scale integration, GST e-invoices, multi-store ERP & inventory control for Indian retailers.",
|
|
keywords: "retail blog, POS guides, billing tutorials, inventory tips, GST billing guide, weighing scale integration, multi-store management, retail technology",
|
|
image: `${mainDirectory}/og/blog-og.jpg`,
|
|
},
|
|
6: {
|
|
title: "About POZO | Retail ERP & POS Solutions for MSMEs",
|
|
description: "Learn about POZO's mission to digitize Indian retail businesses with affordable ERP & POS solutions, billing software, and inventory management.",
|
|
keywords: "about POZO, retail digitization, MSME solutions, Indian retail software, ERP for small business, POS for kirana stores, retail technology company",
|
|
image: `${mainDirectory}/og/about-og.jpg`,
|
|
},
|
|
9: {
|
|
title: "Retail Solutions | ERP & POS Software for Every Business",
|
|
description: "Comprehensive retail solutions: billing software, inventory management, GST compliance, weighing scale integration, and multi-store ERP for Indian businesses.",
|
|
keywords: "retail solutions, comprehensive ERP, POS solutions, billing solutions, inventory solutions, GST compliance software, weighing scale POS, multi-store solutions",
|
|
image: `${mainDirectory}/og/solutions-og.jpg`,
|
|
},
|
|
};
|
|
|
|
async function generateSEOFiles() {
|
|
for (const route of routes) {
|
|
const pageSeo = seoData[route.pageId];
|
|
|
|
const filePath = path.join(__dirname, "../dist", route.path);
|
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
|
|
let html;
|
|
if (fs.existsSync(filePath)) {
|
|
html = fs.readFileSync(filePath, "utf8");
|
|
} else {
|
|
html = fs.readFileSync(path.join(__dirname, "../dist/index.html"), "utf8");
|
|
}
|
|
|
|
// COMPLETE REPLACEMENT - Remove all existing SEO tags first
|
|
html = html
|
|
// Remove all existing meta tags
|
|
.replace(/<meta name="description"[^>]*>/g, '')
|
|
.replace(/<meta property="og:title"[^>]*>/g, '')
|
|
.replace(/<meta property="og:description"[^>]*>/g, '')
|
|
.replace(/<meta property="og:image"[^>]*>/g, '')
|
|
.replace(/<meta property="og:url"[^>]*>/g, '')
|
|
.replace(/<meta property="twitter:title"[^>]*>/g, '')
|
|
.replace(/<meta property="twitter:description"[^>]*>/g, '')
|
|
.replace(/<meta property="twitter:image"[^>]*>/g, '')
|
|
.replace(/<meta property="twitter:url"[^>]*>/g, '')
|
|
.replace(/<link rel="canonical"[^>]*>/g, '');
|
|
|
|
// Replace title
|
|
html = html.replace(/<title>[^<]*<\/title>/g, `<title>${pageSeo.title}</title>`);
|
|
|
|
// Add all new SEO tags after title
|
|
const newSeoTags = `
|
|
<meta name="description" content="${pageSeo.description}" />
|
|
<meta name="keywords" content="${pageSeo.keywords}" />
|
|
|
|
<!-- Open Graph / Facebook -->
|
|
<meta property="og:type" content="website" />
|
|
<meta property="og:url" content="${route.url}" />
|
|
<meta property="og:title" content="${pageSeo.title}" />
|
|
<meta property="og:description" content="${pageSeo.description}" />
|
|
<meta property="og:image" content="${pageSeo.image}" />
|
|
|
|
<!-- Twitter -->
|
|
<meta property="twitter:card" content="summary_large_image" />
|
|
<meta property="twitter:url" content="${route.url}" />
|
|
<meta property="twitter:title" content="${pageSeo.title}" />
|
|
<meta property="twitter:description" content="${pageSeo.description}" />
|
|
<meta property="twitter:image" content="${pageSeo.image}" />
|
|
|
|
<link rel="canonical" href="${route.url}" />`;
|
|
|
|
html = html.replace(/(<title>[^<]*<\/title>)/, `$1${newSeoTags}`);
|
|
|
|
fs.writeFileSync(filePath, html);
|
|
console.log(`✓ Generated ${route.path} with correct SEO`);
|
|
console.log(` Title: ${pageSeo.title}`);
|
|
console.log(` Image: ${pageSeo.image}`);
|
|
console.log(` URL: ${route.url}`);
|
|
console.log('');
|
|
}
|
|
|
|
console.log("✓ All SEO files fixed!");
|
|
}
|
|
|
|
generateSEOFiles().catch(console.error); |