Browse Source
feat: add robots.txt and sitemap.xml for improved SEO, implement custom 404 page with localization support
master
feat: add robots.txt and sitemap.xml for improved SEO, implement custom 404 page with localization support
master
sina_sajjadi
3 days ago
20 changed files with 260 additions and 114 deletions
-
37next-sitemap.config.js
-
BINpublic/assets/images/Icon_Illustration.webp
-
6public/locales/en/common.json
-
10public/robots.txt
-
27public/sitemap-0.xml
-
5public/sitemap.xml
-
46src/components/common/default-seo.tsx
-
2src/components/context/audio-conext.tsx
-
2src/components/layout/header.tsx
-
5src/components/layout/sidebar.tsx
-
102src/components/modals/donate-modal.tsx
-
4src/components/modals/search-modal.tsx
-
5src/components/sidebar/categories.tsx
-
4src/components/sidebar/famous.tsx
-
4src/components/sidebar/nearby.tsx
-
4src/components/sidebar/search.tsx
-
4src/components/sidebar/tabs.tsx
-
4src/components/sidebar/today.tsx
-
34src/pages/404.tsx
-
15src/pages/duas/[slug].tsx
@ -1,12 +1,31 @@ |
|||
const config = { |
|||
siteUrl: 'https://www.example.com', |
|||
generateRobotsTxt: true, |
|||
// next-sitemap.config.js
|
|||
module.exports = { |
|||
siteUrl: 'https://duasapp.com', // Replace with your site's URL
|
|||
generateRobotsTxt: true, // Generates robots.txt alongside the sitemap
|
|||
changefreq: 'monthly', // Set the frequency of page changes
|
|||
priority: 0.8, // Default priority for pages
|
|||
sitemapSize: 5000, // Maximum entries per sitemap file
|
|||
exclude: ['/admin/*', '/dashboard/*', '/404*'], // Exclude specific paths
|
|||
additionalPaths: async (config) => { |
|||
// Custom static paths
|
|||
const staticPaths = [ |
|||
await config.transform(config, '/about'), |
|||
]; |
|||
|
|||
// Dynamic Dua paths (replace this with API call or database query in production)
|
|||
const duaSlugs = ["etiquette-of-reciting-the-request-for-entry", "etiquettes-of-carrying-the-janazah", "dua-abu-hamza-thumali"]; // Example dynamic IDs
|
|||
const dynamicPaths = duaSlugs.map((slug) => ({ |
|||
loc: `/duas/${slug}`, |
|||
lastmod: new Date().toISOString(), |
|||
changefreq: 'monthly', |
|||
priority: 0.9, |
|||
})); |
|||
|
|||
return [...staticPaths, ...dynamicPaths]; |
|||
}, |
|||
robotsTxtOptions: { |
|||
policies: [ |
|||
{ userAgent: '*', allow: '/', disallow: ['/api/', '/admin/', '/private/'] }, |
|||
additionalSitemaps: [ |
|||
'https://duasapp.com/sitemap-0.xml', // Add other sitemaps if necessary
|
|||
], |
|||
}, |
|||
}; |
|||
|
|||
module.exports = config; |
|||
|
|||
}; |
@ -0,0 +1,10 @@ |
|||
# * |
|||
User-agent: * |
|||
Allow: / |
|||
|
|||
# Host |
|||
Host: https://duasapp.com |
|||
|
|||
# Sitemaps |
|||
Sitemap: https://duasapp.com/sitemap.xml |
|||
Sitemap: https://duasapp.com/sitemap-0.xml |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"> |
|||
<url><loc>https://duasapp.com</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/about</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/es/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/de/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/uz/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/pt/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/bn/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/zh/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/az/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/ur/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/fr/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/tr/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/id/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/sw/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/ru/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/ar/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/tg/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/fa/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/gu/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/ks/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/ha/404</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url> |
|||
<url><loc>https://duasapp.com/dua/etiquette-of-reciting-the-request-for-entry</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url> |
|||
<url><loc>https://duasapp.com/dua/etiquettes-of-carrying-the-janazah</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url> |
|||
<url><loc>https://duasapp.com/dua/dua-abu-hamza-thumali</loc><lastmod>2025-01-15T13:11:26.470Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url> |
|||
</urlset> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
|||
<sitemap><loc>https://duasapp.com/sitemap-0.xml</loc></sitemap> |
|||
<sitemap><loc>https://duasapp.com/sitemap-0.xml</loc></sitemap> |
|||
</sitemapindex> |
@ -0,0 +1,34 @@ |
|||
import React from "react"; |
|||
import Link from "next/link"; |
|||
import notFound from "../../public/assets/images/Icon_Illustration.webp"; |
|||
import Image from "next/image"; |
|||
import { serverSideTranslations } from "next-i18next/serverSideTranslations"; |
|||
import { useTranslation } from "next-i18next"; |
|||
|
|||
const NotFound: React.FC = () => { |
|||
const { t } = useTranslation("common"); |
|||
|
|||
return ( |
|||
<div className="w-full h-full flex items-center justify-center mt-[48%]"> |
|||
<div className="text-center"> |
|||
<Image src={notFound} alt={t("notFoundImageAlt")} /> |
|||
<h1 className="text-xl">{t("ohNo")}</h1> |
|||
<p className="text-[#8B8B8B]">{t("somethingWentWrong")}</p> |
|||
<div className="bg-white p-2 rounded-2xl mt-4"> |
|||
<Link href="/">{t("backToHomePage")}</Link> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
); |
|||
}; |
|||
|
|||
export async function getStaticProps({ locale }) { |
|||
return { |
|||
props: { |
|||
...(await serverSideTranslations(locale, ["common", "footer"])), |
|||
// Will be passed to the page component as props
|
|||
}, |
|||
}; |
|||
} |
|||
|
|||
export default NotFound; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue