Skip to content

Commit e11d4ff

Browse files
committed
Add SEO otimizations
1 parent 080e97a commit e11d4ff

5 files changed

Lines changed: 86 additions & 6 deletions

File tree

astro.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import icon from 'astro-icon';
66

77
import cloudflare from "@astrojs/cloudflare";
88

9+
import sitemap from '@astrojs/sitemap';
10+
911
// https://astro.build/config
1012
export default defineConfig({
11-
site: 'https://naapperas.github.io',
12-
integrations: [tailwind(), icon()],
13+
site: 'https://naapperas.pt',
14+
integrations: [tailwind(), icon(), sitemap()],
1315
trailingSlash: 'ignore',
1416
adapter: cloudflare()
1517
});

package-lock.json

Lines changed: 72 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"dependencies": {
1515
"@astrojs/check": "^0.9.4",
1616
"@astrojs/cloudflare": "12",
17+
"@astrojs/sitemap": "^3.7.2",
1718
"@astrojs/tailwind": "^5.1.4",
1819
"@iconify-json/ic": "^1.2.4",
1920
"@iconify-json/logos": "^1.2.11",

src/layouts/Base.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const { title, bgColor, textColor } = Astro.props;
1919
<meta name="description" content="Personal Website for Nuno Pereira" />
2020
<meta name="viewport" content="width=device-width" />
2121
<meta name="generator" content={Astro.generator} />
22+
<link rel="sitemap" href="/sitemap-index.xml" />
2223
<link rel="icon" type="image/x-icon" href="/favicon.svg" />
2324
<title>{title}</title>
2425
</head>

src/pages/robots.txt.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { APIRoute } from 'astro';
2+
3+
const getRobotsTxt = (sitemapURL: URL) => `Sitemap: ${sitemapURL.href}`;
4+
5+
export const GET: APIRoute = ({ site }) => {
6+
const sitemapURL = new URL('sitemap-index.xml', site);
7+
return new Response(getRobotsTxt(sitemapURL));
8+
};

0 commit comments

Comments
 (0)