Skip to content

Commit 3f633e8

Browse files
Merge pull request #453 from myselfshivams/main
added:: Meta Tags, robots.txt, sitemaps for SEO Enhancement
2 parents 5f5974b + 3e6e763 commit 3f633e8

File tree

6 files changed

+74
-0
lines changed

6 files changed

+74
-0
lines changed

frontend/generate-sitemap.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { SitemapStream } from 'sitemap';
2+
import { createWriteStream } from 'fs';
3+
import path from 'path';
4+
import { fileURLToPath } from 'url';
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
7+
const pages = [
8+
{ url: '/', changefreq: 'daily', priority: 1.0 },
9+
];
10+
async function generateSitemap() {
11+
const writeStream = createWriteStream(path.resolve(__dirname, 'public', 'sitemap.xml'));
12+
const sitemap = new SitemapStream({ hostname: 'https://play-cafe.vercel.app/' });
13+
sitemap.pipe(writeStream).on('finish', () => {
14+
console.log('Sitemap generated successfully');
15+
});
16+
pages.forEach(page => sitemap.write(page));
17+
sitemap.end();
18+
}
19+
generateSitemap().catch(error => {
20+
console.error('Error generating sitemap:', error);
21+
});

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
"lucide-react": "^0.454.0",
2929
"react": "^18.3.1",
3030
"react-dom": "^18.3.1",
31+
"react-helmet": "^6.1.0",
3132
"react-icons": "^5.2.1",
3233
"react-intersection-observer": "^9.13.0",
3334
"react-lazy-load-image-component": "^1.6.2",
3435
"react-pageflip": "^2.0.3",
3536
"react-responsive": "^10.0.0",
3637
"react-router-dom": "^6.24.1",
38+
"sitemap": "^8.0.0",
3739
"split-type": "^0.3.4",
3840
"tailwind-merge": "^2.5.2",
3941
"tailwindcss": "^3.4.4",

frontend/public/robots.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
User-agent: *
2+
Disallow: /private
3+
Allow: /
4+
Sitemap: https://play-cafe.vercel.app/sitemap.xml

frontend/public/sitemap.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?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:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"><url><loc>https://play-cafe.vercel.app/</loc><changefreq>daily</changefreq><priority>1.0</priority></url></urlset>

frontend/src/App.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import Footer from '../src/components/Shared/Footer';
55
import { Outlet } from 'react-router-dom';
66
import BackToTopButton from './components/Shared/BackToTopButton';
77
import Preloader from './components/Preloader';
8+
import Metadata from './components/Metadata';
89

910

1011
function App() {
1112
return (
1213
<>
14+
<Metadata />
1315
<Preloader />
1416
<BackToTopButton />
1517
<Navbar />

frontend/src/metadata.jsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import { Helmet } from 'react-helmet';
3+
4+
const Metadata = () => {
5+
return (
6+
<Helmet>
7+
<title>Play Cafe - Where Board Games Meet Great Food</title>
8+
9+
<meta name="description" content="Play Cafe offers a warm and exciting environment for board game enthusiasts to gather, relax, and enjoy great food." />
10+
11+
<meta name="keywords" content="cafe, board games, food, gaming, cafe near me, snacks, beverages, fun activities" />
12+
13+
<meta name="author" content="Play Cafe" />
14+
15+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
16+
17+
{/* Open Graph Tags */}
18+
<meta property="og:title" content="Play Cafe - Where Board Games Meet Great Food" />
19+
<meta property="og:description" content="Join us at Play Cafe for a fun and immersive experience with board games and delicious food!" />
20+
<meta property="og:image" content="URL to image for sharing" />
21+
<meta property="og:url" content="https://play-cafe.vercel.app" />
22+
<meta property="og:type" content="website" />
23+
<meta property="og:site_name" content="Play Cafe" />
24+
25+
{/* Twitter Card Tags */}
26+
<meta name="twitter:card" content="summary_large_image" />
27+
<meta name="twitter:title" content="Play Cafe - Where Board Games Meet Great Food" />
28+
<meta name="twitter:description" content="Play Cafe offers a warm and exciting environment for board game enthusiasts to gather, relax, and enjoy great food." />
29+
<meta name="twitter:image" content="URL to image for sharing" />
30+
<meta name="twitter:site" content="@YourTwitterHandle" />
31+
32+
33+
<link rel="canonical" href="https://play-cafe.vercel.app" />
34+
35+
<meta name="robots" content="index, follow" />
36+
37+
<meta name="theme-color" content="#ffffff" />
38+
<meta name="rating" content="General" />
39+
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
40+
</Helmet>
41+
);
42+
};
43+
44+
export default Metadata;

0 commit comments

Comments
 (0)