Skip to content

Commit

Permalink
canonical url and others
Browse files Browse the repository at this point in the history
  • Loading branch information
landed1 committed Dec 2, 2024
1 parent 0ba0858 commit 2102fca
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 86 deletions.
17 changes: 10 additions & 7 deletions app/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from "react";
import { getPostMeta, getPageContent, getSlugs } from "../lib/getPage";
import { getPostMeta, getPageContent, getFiles } from "../lib/getPage";
import NextBreadcrumb from "../components/NextBreadcrumb";
import { Metadata } from "next";
import { notFound } from "next/navigation";

type Params = {
slug: string;
Expand All @@ -15,23 +16,25 @@ export async function generateMetadata({
const { slug } = await params;
const lePost = await getPostMeta(slug);
const [firstPost] = lePost;
//console.log("what does slug look like for", lePost);
return firstPost;
/* return {
title: lePost[0]?.title || 'Page',
description: lePost[0]?.description || ''
};*/
}
export const generateStaticParams = async () => {
//console.log("static params");
//we need to return all the pages from the .md files in a specific folder.
const slugs = await getSlugs();
//slugs ['about2.md','extra.md','random'] - an array of markdown files
const slugs = await getFiles();
return slugs.map((page) => ({
slug: page.replace(".md", ""),
}));
//slugs ['about2.md','extra.md','random'] - an array of markdown files
};

export default async function Page({ params }: { params: Params }) {
const pageC = await getPageContent(params.slug);
if (!getPageContent(params.slug)) {
notFound();
return;
}
//console.log("page Content", pageC.contentHtml);
const newPage = pageC.contentHtml;
return (
Expand Down
6 changes: 6 additions & 0 deletions app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import NextBreadcrumb from "../components/NextBreadcrumb";

export const metadata = {
title: "About PoolsDubai",
description:
"We are a Dubai Swimming Pool Contractor, learn more about us on this page",
};

export default function About() {
return (
<div className='my-20'>
Expand Down
2 changes: 1 addition & 1 deletion app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default async function Blog() {
titre: pageList[index],
}));

console.log("page ", postData);
// console.log("page ", postData);

return (
<div className='my-20'>
Expand Down
201 changes: 124 additions & 77 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,97 +1,144 @@
import "./globals.css";
import NavBar from "./components/NavBar";
import { Phone, Mail, MapPin,Facebook,Instagram,Twitter } from 'lucide-react';
import localFont from 'next/font/local';
import Link from 'next/link';
import {
Phone,
Mail,
MapPin,
Facebook,
Instagram,
Twitter,
} from "lucide-react";
import localFont from "next/font/local";
import Link from "next/link";

const notio =localFont({
src:[
{
path:'./fonts/NotoSans-Regular.ttf',
weight:'400',
style:'regular'
},
{
path:'./fonts/NotoSans-Italic.ttf',
weight:'400',
style:'italic'
}
],variable: '--font-notio',
})
const notio = localFont({
src: [
{
path: "./fonts/NotoSans-Regular.ttf",
weight: "400",
style: "regular",
},
{
path: "./fonts/NotoSans-Italic.ttf",
weight: "400",
style: "italic",
},
],
variable: "--font-notio",
});

export const metadata ={
title:"Dubai Pool Company Website",
description:"We are your friendly Dubai Pool Company. Offering services from design and construction to maintenance and safety."
}
export const metadata = {
title: "Dubai Pool Company Website",
description:
"We are your friendly Dubai Pool Company. Offering services from design and construction to maintenance and safety.",
metadataBase: new URL("https://dubaipools.com"),
alternates: {
canonical: "./",
},
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en" className={`${notio.className}`}>
<body className="min-h-screen flex flex-col">
<header className="sticky top-0 z-50">
<html lang='en' className={`${notio.className}`}>
<body className='min-h-screen flex flex-col'>
<header className='sticky top-0 z-50'>
<NavBar />
</header>
{children}
<footer className="bg-[#2C2C54] text-white py-12">
<div className="container mx-auto px-4">
<div className="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<h3 className="text-xl font-bold mb-4">About Us</h3>
<p className="text-[#AAABB8]">
Premium pool maintenance services in Dubai, ensuring your pool stays pristine year-round.
</p>
</div>
<div>
<h3 className="text-xl font-bold mb-4">Contact</h3>
<ul className="space-y-2 text-[#AAABB8]">
<li className="flex items-center">
<Phone className="w-4 h-4 mr-2" />
+971 50 123 4567
</li>
<li className="flex items-center">
<Mail className="w-4 h-4 mr-2" />
[email protected]
</li>
<li className="flex items-center">
<MapPin className="w-4 h-4 mr-2" />
Dubai, UAE
</li>
</ul>
</div>
<div>
<h3 className="text-xl font-bold mb-4"><Link href="/services">Services</Link></h3>
<ul className="space-y-2 text-[#AAABB8]">
<li><Link href="/services/pool-maintenance">Pool Maintenance</Link></li>
<li><Link href="/services/pool-design-construction">Pool Design & Construction</Link></li>
<li><Link href="/services/water-testing">Water Testing</Link></li>
<li><Link href="/services/chemical-balancing">Chemical Balancing</Link></li>
<li><Link href="/services/equipment-repair">Equipment Repair</Link></li>
<li><Link href="/services/pool-renovation">Pool Renovation</Link></li>
</ul>
</div>
<div>
<h3 className="text-xl font-bold mb-4">Follow Us</h3>
<div className="flex space-x-4">
<a href="#" className="text-[#AAABB8] hover:text-white transition-colors">
<Facebook className="w-6 h-6" />
</a>
<a href="#" className="text-[#AAABB8] hover:text-white transition-colors">
<Instagram className="w-6 h-6" />
</a>
<a href="#" className="text-[#AAABB8] hover:text-white transition-colors">
<Twitter className="w-6 h-6" />
</a>
</div>
</div>
<footer className='bg-[#2C2C54] text-white py-12'>
<div className='container mx-auto px-4'>
<div className='grid grid-cols-1 md:grid-cols-4 gap-8'>
<div>
<h3 className='text-xl font-bold mb-4'>About Us</h3>
<p className='text-[#AAABB8]'>
Premium pool maintenance services in Dubai, ensuring your pool
stays pristine year-round.
</p>
</div>
<div>
<h3 className='text-xl font-bold mb-4'>Contact</h3>
<ul className='space-y-2 text-[#AAABB8]'>
<li className='flex items-center'>
<Phone className='w-4 h-4 mr-2' />
+971 50 123 4567
</li>
<li className='flex items-center'>
<Mail className='w-4 h-4 mr-2' />
[email protected]
</li>
<li className='flex items-center'>
<MapPin className='w-4 h-4 mr-2' />
Dubai, UAE
</li>
</ul>
</div>
<div className="border-t border-[#474787] mt-8 pt-8 text-center text-[#AAABB8]">
<p>&copy; {new Date().getFullYear()} Dubai Pool Services. All rights reserved.</p>
<div>
<h3 className='text-xl font-bold mb-4'>
<Link href='/services'>Services</Link>
</h3>
<ul className='space-y-2 text-[#AAABB8]'>
<li>
<Link href='/services/pool-maintenance'>
Pool Maintenance
</Link>
</li>
<li>
<Link href='/services/pool-design-construction'>
Pool Design & Construction
</Link>
</li>
<li>
<Link href='/services/water-testing'>Water Testing</Link>
</li>
<li>
<Link href='/services/chemical-balancing'>
Chemical Balancing
</Link>
</li>
<li>
<Link href='/services/equipment-repair'>
Equipment Repair
</Link>
</li>
<li>
<Link href='/services/pool-renovation'>
Pool Renovation
</Link>
</li>
</ul>
</div>
<div>
<h3 className='text-xl font-bold mb-4'>Follow Us</h3>
<div className='flex space-x-4'>
<a
href='#'
className='text-[#AAABB8] hover:text-white transition-colors'>
<Facebook className='w-6 h-6' />
</a>
<a
href='#'
className='text-[#AAABB8] hover:text-white transition-colors'>
<Instagram className='w-6 h-6' />
</a>
<a
href='#'
className='text-[#AAABB8] hover:text-white transition-colors'>
<Twitter className='w-6 h-6' />
</a>
</div>
</div>
</div>
<div className='border-t border-[#474787] mt-8 pt-8 text-center text-[#AAABB8]'>
<p>
&copy; {new Date().getFullYear()} Dubai Pool Services. All
rights reserved.
</p>
</div>
</div>
</footer>
</body>
</html>
Expand Down
5 changes: 5 additions & 0 deletions app/lib/getPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import gfm from 'remark-gfm'; // Import the plugin for tables
//global files used in both methods
const files = fs.readdirSync(path.join(process.cwd(), '/content'));

export async function getFiles(){
const fileWithEx = await files;
return fileWithEx;
}

export async function getSlugs(){
const fileNoEx = files.map(file => file.replace('.md', ''));
return fileNoEx;
Expand Down
3 changes: 2 additions & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
User-agent: *
Allow: /
Allow: /
Sitemap: https://poolsdubai.com/sitemap.xml

0 comments on commit 2102fca

Please sign in to comment.