Skip to content

Commit

Permalink
Add sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
gnovl committed Oct 17, 2024
1 parent 3386e4f commit b552e9f
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 25 deletions.
12 changes: 12 additions & 0 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.SITE_URL || "https://averiashogar.es",
generateRobotsTxt: true,
sitemapSize: 7000,
changefreq: "daily",
priority: 0.7,
exclude: ["/server-sitemap.xml"],
robotsTxtOptions: {
additionalSitemaps: ["https://averiashogar.es/server-sitemap.xml"],
},
};
5 changes: 5 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const nextConfig = {
RECAPTCHA_SECRET_KEY: process.env.RECAPTCHA_SECRET_KEY,
NEXT_PUBLIC_RECAPTCHA_SITE_KEY: process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY,
},
images: {
domains: ["averiashogar.es"], // Add domains for external images
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
};

const withMDX = nextMDX({
Expand Down
59 changes: 40 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"hamburger-react": "^2.5.1",
"next": "14.2.3",
"next-mdx-remote": "^5.0.0",
"next-sitemap": "^4.2.3",
"qrcode.react": "^3.1.0",
"react": "^18",
"react-dom": "^18",
Expand Down
10 changes: 10 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# *
User-agent: *
Allow: /

# Host
Host: https://averiashogar.es

# Sitemaps
Sitemap: https://averiashogar.es/sitemap.xml
Sitemap: https://averiashogar.es/server-sitemap.xml
4 changes: 4 additions & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://averiashogar.es/server-sitemap.xml</loc></sitemap>
</sitemapindex>
12 changes: 6 additions & 6 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "AVERÍAS HOGAR - REPARACIÓN AVERÍAS FONTANERÍA MADRID",
description:
"Fontanero en Madrid especializado en averías, reparaciones y mantenimiento del hogar. Servicios de fontanería, calefacción y pintura interior. Llame al 689 680 473.",
"Fontanero en Madrid especializado en averías, reparaciones y mantenimiento del hogar. Servicios de fontanería, calefacción y pintura interior. Llame al 123123123.",
metadataBase: new URL("https://averiashogar.es"),
icons: {
icon: ["/favicon.ico?v=4"],
Expand All @@ -17,12 +17,12 @@ export const metadata: Metadata = {
openGraph: {
title: "AVERIAS HOGAR - Fontanero en Madrid",
description:
"Expertos en averías y reparaciones del hogar. Fontanería, calefacción y pintura interior en la Comunidad de Madrid. Llame al 689 680 473.",
"Expertos en averías y reparaciones del hogar. Fontanería, calefacción y pintura interior en la Comunidad de Madrid. Llame al 123123123.",
url: "https://averiashogar.es",
siteName: "AVERIAS HOGAR",
images: [
{
url: "/Logo-mini.png", // Replace with the actual path to your image
url: "https://averiashogar.es/Logo-mini.png", // Replace with the actual path to your image
width: 1200,
height: 630,
alt: "AVERIAS HOGAR - Fontanero Madrid - Servicios de reparación y averías",
Expand All @@ -35,8 +35,8 @@ export const metadata: Metadata = {
card: "summary_large_image",
title: "AVERIAS HOGAR - Fontanero en Madrid",
description:
"Expertos en averías y reparaciones del hogar. Fontanería, calefacción y pintura interior en la Comunidad de Madrid. Llame al 689 680 473.",
images: ["/Logo-mini.png"], // Replace with the actual path to your image
"Expertos en averías y reparaciones del hogar. Fontanería, calefacción y pintura interior en la Comunidad de Madrid. Llame al 123123123.",
images: ["https://averiashogar.es/Logo-mini.png"], // Replace with the actual path to your image
},
};

Expand All @@ -46,7 +46,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang="es">
<body className={inter.className}>{children}</body>
</html>
);
Expand Down
40 changes: 40 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ScrollToTop from "react-scroll-to-top";
import { ConsentBanner, ConsentProvider } from "react-hook-consent";
import "react-hook-consent/dist/styles/style.css";
import Link from "next/link";
import Script from "next/script";

export default function Home() {
return (
Expand Down Expand Up @@ -59,6 +60,45 @@ export default function Home() {
</>
</ConsentBanner>
</div>
<Script
id="structured-data"
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "LocalBusiness",
name: "AVERIAS HOGAR",
description:
"Fontanero en Madrid especializado en averías, reparaciones y mantenimiento del hogar. Servicios de fontanería, calefacción y pintura interior.",
url: "https://averiashogar.es",
telephone: "123123123",
address: {
"@type": "PostalAddress",
addressLocality: "Madrid",
addressRegion: "Madrid",
addressCountry: "ES",
},
geo: {
"@type": "GeoCoordinates",
latitude: 40.4168, // Replace with actual coordinates
longitude: -3.7038, // Replace with actual coordinates
},
openingHoursSpecification: {
"@type": "OpeningHoursSpecification",
dayOfWeek: [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
],
opens: "00:00",
closes: "23:59",
},
}),
}}
/>
</ConsentProvider>
);
}

0 comments on commit b552e9f

Please sign in to comment.