Skip to content

Commit

Permalink
add more SEO support
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Sep 20, 2024
1 parent bed00fa commit 33bd24a
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
4 changes: 3 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import mdx from '@astrojs/mdx';
import icon from 'astro-icon';
import pagefind from "astro-pagefind";

import sitemap from '@astrojs/sitemap';

// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), mdx(), icon(), pagefind()],
integrations: [tailwind(), mdx(), icon(), pagefind(), sitemap()],
site: 'https://nfdi4plants.github.io',
base: '/arc-website/', // will kill pagefind integration without trailing slash
markdown: {
Expand Down
58 changes: 58 additions & 0 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 @@ -12,6 +12,7 @@
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/mdx": "^3.1.5",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/tailwind": "^5.1.0",
"@iconify-json/mdi": "^1.2.0",
"@tailwindcss/typography": "^0.5.15",
Expand Down
13 changes: 13 additions & 0 deletions 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 33bd24a

Please sign in to comment.