-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked Sitemap and minor bugfixes and UI improvements
You can now access paths directly via /path, meaning that sitemaps have been updated to respect conventional sitemapping. Additionally, some UI improvements and bugfxies have been made.
- Loading branch information
1 parent
3266c65
commit d6c4b29
Showing
8 changed files
with
77 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { getServerSideSitemap, ISitemapField } from "next-sitemap"; | ||
import { fetchSitemap } from "@/actions/actions"; | ||
import IDoc from "@/types/server-sitemap"; | ||
|
||
export const GET = async (request: Request) => { | ||
const data = await fetchSitemap(), | ||
URLs: ISitemapField[] = []; | ||
|
||
const addURLs = (category: string, basePath: { en: string; fr: string }) => { | ||
data[category].docs.forEach((doc: IDoc) => { | ||
URLs.push({ | ||
loc: `https://www.g-yachts.com/${basePath.en}/${doc.id}`, | ||
lastmod: doc.updatedAt, | ||
priority: 0.8, | ||
alternateRefs: [ | ||
{ | ||
href: `https://www.g-yachts.com/${basePath.fr}/${doc.id}`, | ||
hreflang: "fr", | ||
}, | ||
{ | ||
href: `https://www.g-yachts.com/en/${basePath.en}/${doc.id}`, | ||
hreflang: "en", | ||
}, | ||
{ | ||
href: `https://www.g-yachts.com/fr/${basePath.fr}/${doc.id}`, | ||
hreflang: "fr", | ||
}, | ||
], | ||
}); | ||
}); | ||
}; | ||
|
||
addURLs("Yachts", { en: "sales", fr: "ventes" }); | ||
addURLs("Charters", { en: "charters", fr: "charters" }); | ||
addURLs("NewConstructions", { | ||
en: "new-constructions", | ||
fr: "nouvelles-constructions", | ||
}); | ||
addURLs("Destinations", { en: "destinations", fr: "destinations" }); | ||
addURLs("Articles", { en: "news", fr: "actualites" }); | ||
addURLs("Events", { en: "events", fr: "evenements" }); | ||
|
||
return getServerSideSitemap(URLs); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters