diff --git a/app/contact-us/page.js b/app/contact-south-indian-restaurant/page.js similarity index 100% rename from app/contact-us/page.js rename to app/contact-south-indian-restaurant/page.js diff --git a/app/layout.js b/app/layout.js index c715384..c65f713 100644 --- a/app/layout.js +++ b/app/layout.js @@ -8,7 +8,7 @@ import "@css/slick.min.css"; import "@css/style.css"; import "./globals.css"; export const metadata = { - title: "Shivasakthi Restaurant – Home-Style South Indian Dining & Weekend Unlimited Thali", + title: "Shivasakthi Restaurant | South Indian Dining & Thali", description: "The best Indian food in Mississauga! Enjoy authentic South Indian cuisine, vegetarian dishes, dosa, Indian snacks, and takeout options at Shiva Sakthi.", }; diff --git a/components/About/AboutCallAction2.js b/components/About/AboutCallAction2.js index 0950aa6..a21c142 100644 --- a/components/About/AboutCallAction2.js +++ b/components/About/AboutCallAction2.js @@ -12,7 +12,7 @@ Craving Authentic Indian Flavors?

Don’t wait—call us now to place your order!

- + Call Us {/*
{
  • Home
  • About
  • Menu
  • -
  • Contact
  • +
  • Contact
  • diff --git a/layout/Header.js b/layout/Header.js index fbe0ee2..63f6508 100644 --- a/layout/Header.js +++ b/layout/Header.js @@ -320,7 +320,7 @@ const MobileMenu = () => { */}
  • - Contact + Contact
  • {/*
    diff --git a/package.json b/package.json index b512396..503ae31 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,13 @@ "name": "shivasakthi-restarunt", "version": "0.1.0", "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint" - }, +"scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint", + "sitemap": "node scripts/generate-sitemap.cjs" +}, "dependencies": { "aos": "^2.3.4", "axios": "^1.9.0", diff --git a/public/sitemap.xml b/public/sitemap.xml index e97ca4e..80ace78 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -1 +1 @@ -https://shivasakthi.ca/daily1.0https://shivasakthi.ca/aboutweekly0.7https://shivasakthi.ca/menuweekly0.7https://shivasakthi.ca/blogweekly0.7https://shivasakthi.ca/contactmonthly0.5https://shivasakthi.ca/blog/the-flavors-of-north-india-more-than-just-curriesweekly0.6https://shivasakthi.ca/blog/the-secret-to-perfect-north-indian-curriesweekly0.6https://shivasakthi.ca/blog/the-rich-history-of-south-indian-cuisineweekly0.6 \ No newline at end of file +https://shivasakthi.ca/daily1.0https://shivasakthi.ca/about/weekly0.7https://shivasakthi.ca/menu/weekly0.7https://shivasakthi.ca/blog/weekly0.7https://shivasakthi.ca/contact-south-indian-restaurant/monthly0.5https://shivasakthi.ca/blog/the-flavors-of-north-india-more-than-just-curries/weekly0.6https://shivasakthi.ca/blog/the-secret-to-perfect-north-indian-curries/weekly0.6https://shivasakthi.ca/blog/the-rich-history-of-south-indian-cuisine/weekly0.6 \ No newline at end of file diff --git a/scripts/generate-sitemap.cjs b/scripts/generate-sitemap.cjs index 841217d..9ebf47d 100644 --- a/scripts/generate-sitemap.cjs +++ b/scripts/generate-sitemap.cjs @@ -1,47 +1,79 @@ -const fs = require('fs'); -const { SitemapStream, streamToPromise } = require('sitemap'); -const path = require('path'); +const fs = require("fs"); +const path = require("path"); +const { SitemapStream, streamToPromise } = require("sitemap"); + +const hostname = "https://shivasakthi.ca"; +const addTrailingSlash = true; // Set true if your Next.js has trailingSlash: true + +// ✅ Utility to control trailing slashes +const shouldAddSlash = (url) => { + if (url === "/") return false; + if (/\.[a-z0-9]{2,6}(\?.*)?$/i.test(url)) return false; + return true; +}; + +const formatUrl = (url) => { + if (!url.startsWith("/")) url = "/" + url; + + if (addTrailingSlash && shouldAddSlash(url) && !url.endsWith("/")) { + return url + "/"; + } + if (!addTrailingSlash && url.endsWith("/") && url !== "/") { + return url.slice(0, -1); + } + return url; +}; -// ✅ Static pages const staticLinks = [ - { url: '/', changefreq: 'daily', priority: 1.0 }, - { url: '/about', changefreq: 'weekly', priority: 0.7 }, - { url: '/menu', changefreq: 'weekly', priority: 0.7 }, - { url: '/blog', changefreq: 'weekly', priority: 0.7 }, - { url: '/contact-us', changefreq: 'monthly', priority: 0.5 } + { url: "/", changefreq: "daily", priority: 1.0 }, + { url: "/about", changefreq: "weekly", priority: 0.7 }, + { url: "/menu", changefreq: "weekly", priority: 0.7 }, + { url: "/blog", changefreq: "weekly", priority: 0.7 }, + { url: "/contact-south-indian-restaurant", changefreq: "monthly", priority: 0.5 }, ]; // ✅ Dynamic blog posts (example) const blogPosts = [ - { slug: 'the-flavors-of-north-india-more-than-just-curries' }, - { slug: 'the-secret-to-perfect-north-indian-curries' }, - { slug: 'the-rich-history-of-south-indian-cuisine' } + { slug: "/blog/the-flavors-of-north-india-more-than-just-curries/" }, + { slug: "/blog/the-secret-to-perfect-north-indian-curries/" }, + { slug: "/blog/the-rich-history-of-south-indian-cuisine/" }, ]; -// Convert blog slugs to sitemap entries -const blogLinks = blogPosts.map(post => ({ - url: `/blog/${post.slug}`, - changefreq: 'weekly', - priority: 0.6 +// // Convert blog slugs to sitemap entries +const blogLinks = blogPosts.map((post) => ({ + url: formatUrl(post.slug), + changefreq: "weekly", + priority: 0.6, })); -const allLinks = [...staticLinks, ...blogLinks]; +const allLinks = [...staticLinks, ...blogLinks].map((link) => ({ + ...link, + url: formatUrl(link.url), +})); async function generateSitemap() { - try { - const sitemap = new SitemapStream({ hostname: 'https://shivasakthi.ca/' }); - const writeStream = fs.createWriteStream(path.resolve(__dirname, '../public/sitemap.xml')); + try { + const sitemap = new SitemapStream({ hostname }); + const writeStream = fs.createWriteStream( + path.resolve(__dirname, "../public/sitemap.xml") + ); - sitemap.pipe(writeStream); + sitemap.pipe(writeStream); - allLinks.forEach(link => sitemap.write(link)); - sitemap.end(); + console.log("📦 Writing URLs to sitemap:"); + allLinks.forEach((link) => { + const fullUrl = `${hostname}${link.url}`; + console.log(" -", fullUrl); + sitemap.write(link); + }); - await streamToPromise(sitemap); - console.log('✅ sitemap.xml created with blog slugs!'); - } catch (error) { - console.error('❌ Error creating sitemap.xml:', error); - } + sitemap.end(); + await streamToPromise(sitemap); + + console.log("✅ sitemap.xml created successfully!"); + } catch (error) { + console.error("❌ Error creating sitemap.xml:", error); + } } generateSitemap();