Skip to content

Commit

Permalink
feat(hompage): add sitemap and robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
serjilyashenko committed Oct 20, 2024
1 parent e66f2f1 commit 0a6a8bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/homepage/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import starlight from "@astrojs/starlight";

// https://astro.build/config
export default defineConfig({
site: 'https://simple-pie.netlify.app/',
integrations: [
starlight({
title: "Simple Pie",
Expand Down
13 changes: 13 additions & 0 deletions apps/homepage/src/pages/robots.txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { APIRoute } from 'astro';

const getRobotsTxt = (sitemapURL: URL) => `
User-agent: *
Allow: /
Sitemap: ${sitemapURL.href}
`;

export const GET: APIRoute = ({ site }) => {
const sitemapURL = new URL('sitemap-index.xml', site);
return new Response(getRobotsTxt(sitemapURL));
};

0 comments on commit 0a6a8bd

Please sign in to comment.