Skip to content

Commit

Permalink
added:: Missing Meta Tags, robots.txt, sitemaps for SEO Enhancement (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
myselfshivams authored Nov 2, 2024
1 parent 121635b commit 2db9ef6
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 0 deletions.
22 changes: 22 additions & 0 deletions generate-sitemap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { SitemapStream } from 'sitemap';
import { createWriteStream } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const pages = [
{ url: '/', changefreq: 'daily', priority: 1.0 },

];
async function generateSitemap() {
const writeStream = createWriteStream(path.resolve(__dirname, 'public', 'sitemap.xml'));
const sitemap = new SitemapStream({ hostname: 'https://befiteveryday.netlify.app/' });
sitemap.pipe(writeStream).on('finish', () => {
console.log('Sitemap generated successfully');
});
pages.forEach(page => sitemap.write(page));
sitemap.end();
}
generateSitemap().catch(error => {
console.error('Error generating sitemap:', error);
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"react-chartjs-2": "^5.2.0",
"react-countup": "^6.5.3",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.53.0",
"react-hot-toast": "^2.4.1",
"react-icons": "^5.2.1",
Expand All @@ -50,6 +51,7 @@
"react-slick": "^0.30.2",
"react-toastify": "^10.0.5",
"react-visibility-sensor": "^5.1.1",
"sitemap": "^8.0.0",
"slick-carousel": "^1.8.1",
"styled-components": "^4.0.0",
"tailwind": "^4.0.0",
Expand Down
4 changes: 4 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Disallow: /private
Allow: /
Sitemap: https://befiteveryday.netlify.app/sitemap.xml
1 change: 1 addition & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +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://befiteveryday.netlify.app/</loc><changefreq>daily</changefreq><priority>1.0</priority></url></urlset>
2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import BackToTopButton from "./components/BacktoTop.jsx";
import HealthTips from "./components/healthtips.jsx"; // Import Back to Top Button
import PrivacyPolicy from "./views/PrivacyPolicy.jsx";
import TermsOfUse from "./views/Terms.jsx";
import Metadata from "./metadata";

const Navbar = lazy(() => import("./components/Navbar.jsx"));
const Home = lazy(() => import("./views/Home.jsx"));
Expand Down Expand Up @@ -68,6 +69,7 @@ function App() {
<Suspense fallback={<Loader />}>
<BlogProvider>
<BrowserRouter>
< Metadata />
<ProgressBar />
<Navbar mode={mode} toggleMode={toggleMode} />
<Routes>
Expand Down
39 changes: 39 additions & 0 deletions src/metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Helmet } from "react-helmet";

const Metadata = () => (
<Helmet>
<title>FitFlex - Your Fitness Journey</title>
<meta
name="description"
content="FitFlex is a fitness and weight loss website offering daily, structured workout plans for a set period. Users can follow day-wise exercises tailored to their goals."
/>
<meta name="keywords" content="fitness, weight loss, workout plans, health, exercise" />
<meta name="author" content="Your Name" />


<meta property="og:title" content="FitFlex - Your Fitness Journey" />
<meta
property="og:description"
content="Join FitFlex to access daily workout plans that cater to your fitness goals."
/>
<meta property="og:image" content="https://befiteveryday.netlify.app/og-image.jpg" />
<meta property="og:url" content="https://befiteveryday.netlify.app" />
<meta property="og:type" content="website" />


<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="FitFlex - Your Fitness Journey" />
<meta
name="twitter:description"
content="Access structured workout plans for weight loss and fitness with FitFlex."
/>
<meta name="twitter:image" content="https://befiteveryday.netlify.app/og-image.jpg" />


<meta name="robots" content="index, follow" />

<link rel="canonical" href="https://befiteveryday.netlify.app" />
</Helmet>
);

export default Metadata;

0 comments on commit 2db9ef6

Please sign in to comment.