Skip to content

Commit

Permalink
🎶 made le sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
parchinski committed Jan 15, 2025
1 parent d019f74 commit 190a854
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
45 changes: 45 additions & 0 deletions app/routes/sitemap[.]xml.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type { LoaderFunction } from '@remix-run/cloudflare';

export const loader: LoaderFunction = async () => {
const baseUrl = 'https://hackucf-remix.pages.dev';

// Define your routes
const routes = [
'',
'about-us',
'competitions',
'constitution',
'sponsorship',
'contact-us',
'nonprofit',
'calendar',
'execs',
'wicys',
'ccdc',
'ctf',
'faq',
];

const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${routes
.map(
route => `
<url>
<loc>${baseUrl}${route ? `/${route}` : ''}</loc>
<lastmod>${new Date().toISOString()}</lastmod>
<changefreq>weekly</changefreq>
<priority>${route === '' ? '1.0' : '0.8'}</priority>
</url>
`,
)
.join('')}
</urlset>`;

return new Response(sitemap, {
headers: {
'Content-Type': 'application/xml',
'Cache-Control': 'public, max-age=3600',
},
});
};
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: *
Allow: /

Sitemap: https://hackucf-remix.pages.dev/sitemap.xml

0 comments on commit 190a854

Please sign in to comment.