Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<a href="#rocket-nextjs-documentation">Next.js documentation</a>
</p>

## SkateHub Frontend powered by Next.js
## SkateHub Frontend

The project requires [Next.js](https://nextjs.org), [Node.js](https://nodejs.org) and [Backend-GraduateProgram-FullStack-2023](https://github.com/jpcmf/Backend-GraduateProgram-FullStack-2023) to run locally.

Expand Down Expand Up @@ -80,6 +80,7 @@ And that's it! Your `SkateHub Frontend` should now be up and running locally on

### 2024

- 2024-11-19 - Create an API Route for the Sitemap [#62](https://github.com/jpcmf/Frontend-GraduateProgram-FullStack-2024/pull/62) _(v0.1.23)_
- 2024-11-13 - Add reCAPTCHA verification to sign-in process [#59](https://github.com/jpcmf/Frontend-GraduateProgram-FullStack-2024/pull/59) _(v0.1.22)_
- 2024-11-08 - Add Husky [#53](https://github.com/jpcmf/Frontend-GraduateProgram-FullStack-2024/pull/53) _(v0.1.21)_
- 2024-11-08 - Add vercel development deployment configuration [#31](https://github.com/jpcmf/Frontend-GraduateProgram-FullStack-2024/pull/31) _(v0.1.20)_
Expand Down Expand Up @@ -115,4 +116,4 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next

---

Made with 💙 by João Paulo Fricks
Made with <span style="color: #6664F1;">&hearts;</span> in Brazil
11 changes: 10 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
rewrites: async () => {
return [
{
source: "/sitemap.xml",
destination: "/api/sitemap"
}
];
}
};

module.exports = nextConfig;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "0.1.22",
"version": "0.1.23",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
31 changes: 31 additions & 0 deletions src/pages/api/sitemap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { NextApiRequest, NextApiResponse } from "next";

const baseUrl = "https://skatehub.vercel.app/";

const routes = [
{ url: "", changeFrequency: "monthly", priority: 1 },
{ url: "dashboard", changeFrequency: "monthly", priority: 0.8 },
{ url: "auth/signup", changeFrequency: "monthly", priority: 0.8 }
];

export default function handler(req: NextApiRequest, res: NextApiResponse) {
const sitemap = routes
.map(
({ url, changeFrequency, priority }) => `
<url>
<loc>${baseUrl}${url}</loc>
<lastmod>${new Date().toISOString()}</lastmod>
<changefreq>${changeFrequency}</changefreq>
<priority>${priority}</priority>
</url>
`
)
.join("");

res.setHeader("Content-Type", "application/xml");
res.status(200).send(`<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${sitemap}
</urlset>
`);
}