From 37e3e8260e69c26ef76442550c26e5d73409d5fa Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Mon, 12 Jun 2023 19:30:39 +0200 Subject: [PATCH] feat: add sitemap --- astro.config.mjs | 44 ++++++++++++------- package.json | 1 + pnpm-lock.yaml | 82 ++++++++++++++++++++++++------------ public/robots.txt | 2 +- src/layouts/BaseLayout.astro | 1 + 5 files changed, 87 insertions(+), 43 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 89bad2d..455f573 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,24 +1,36 @@ import mdx from '@astrojs/mdx'; import preact from '@astrojs/preact'; +import prefetch from '@astrojs/prefetch'; +import sitemap from '@astrojs/sitemap'; import tailwind from '@astrojs/tailwind'; import { astroImageTools } from 'astro-imagetools'; -import { remarkReadingTime, remarkWidont } from './src/utils'; import { defineConfig } from 'astro/config'; - -import prefetch from "@astrojs/prefetch"; +import { remarkReadingTime, remarkWidont } from './src/utils'; // https://astro.build/config export default defineConfig({ - markdown: { - shikiConfig: { - theme: 'nord', - langs: [], - wrap: true - } - }, - integrations: [mdx({ - remarkPlugins: [remarkReadingTime, remarkWidont] - }), tailwind(), preact({ - compat: true - }), astroImageTools, prefetch()] -}); \ No newline at end of file + site: 'https://www.stefanimhoff.de', + markdown: { + shikiConfig: { + theme: 'nord', + langs: [], + wrap: true, + }, + }, + integrations: [ + mdx({ + remarkPlugins: [remarkReadingTime, remarkWidont], + }), + tailwind(), + preact({ + compat: true, + }), + astroImageTools, + prefetch(), + sitemap({ + filter: (page) => + page !== 'https://www.stefanimhoff.de/cv/' && + page !== 'https://www.stefanimhoff.de/imprint/', + }), + ], +}); diff --git a/package.json b/package.json index 3493c6a..4f42551 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@astrojs/mdx": "^0.19.4", "@astrojs/preact": "^2.2.0", "@astrojs/prefetch": "^0.2.3", + "@astrojs/sitemap": "^1.3.3", "@astrojs/tailwind": "^3.1.3", "astro": "^2.5.5", "astro-icon": "^0.8.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fab8d19..540cf68 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: true @@ -21,12 +21,15 @@ dependencies: '@astrojs/prefetch': specifier: ^0.2.3 version: 0.2.3 + '@astrojs/sitemap': + specifier: ^1.3.3 + version: 1.3.3 '@astrojs/tailwind': specifier: ^3.1.3 version: 3.1.3(astro@2.5.5)(tailwindcss@3.3.2) astro: specifier: ^2.5.5 - version: 2.5.5(@types/node@16.9.1)(sharp@0.32.1) + version: 2.5.5(@types/node@17.0.45)(sharp@0.32.1) astro-icon: specifier: ^0.8.0 version: 0.8.0 @@ -142,7 +145,7 @@ devDependencies: version: 13.2.2 netlify-cli: specifier: ^15.4.1 - version: 15.4.1(@types/node@16.9.1) + version: 15.4.1(@types/node@17.0.45) npm-run-all: specifier: ^4.1.5 version: 4.1.5 @@ -178,7 +181,7 @@ devDependencies: version: 5.0.4 vite: specifier: ^4.3.9 - version: 4.3.9(@types/node@16.9.1) + version: 4.3.9(@types/node@17.0.45) packages: @@ -199,7 +202,7 @@ packages: peerDependencies: astro: ^1.0.0 || ^2.0.0-beta dependencies: - astro: 2.5.5(@types/node@16.9.1)(sharp@0.32.1) + astro: 2.5.5(@types/node@17.0.45)(sharp@0.32.1) lite-youtube-embed: 0.2.0 dev: false @@ -231,7 +234,7 @@ packages: astro: ^2.5.0 dependencies: '@astrojs/prism': 2.1.2 - astro: 2.5.5(@types/node@16.9.1)(sharp@0.32.1) + astro: 2.5.5(@types/node@17.0.45)(sharp@0.32.1) github-slugger: 1.5.0 import-meta-resolve: 2.2.2 rehype-raw: 6.1.1 @@ -305,6 +308,13 @@ packages: prismjs: 1.29.0 dev: false + /@astrojs/sitemap@1.3.3: + resolution: {integrity: sha512-TPyyb/hKxc+bHPpSoNPhsuI0QOTVzq2tueg2r0CTH1HqigYIAA2LQkCBlQzz85R+LrOZpv4kXYmhxdDcSkJCmA==} + dependencies: + sitemap: 7.1.1 + zod: 3.21.4 + dev: false + /@astrojs/tailwind@3.1.3(astro@2.5.5)(tailwindcss@3.3.2): resolution: {integrity: sha512-10S1omrv5K5HRVAZ0fBgN5vQykn2HRL332LAVFyBASMn1Ff6gDfSK+CPUeUu94eZUOEaPnECLK8EHAqZ8iY9CA==} peerDependencies: @@ -312,7 +322,7 @@ packages: tailwindcss: ^3.0.24 dependencies: '@proload/core': 0.3.3 - astro: 2.5.5(@types/node@16.9.1)(sharp@0.32.1) + astro: 2.5.5(@types/node@17.0.45)(sharp@0.32.1) autoprefixer: 10.4.14(postcss@8.4.24) postcss: 8.4.24 postcss-load-config: 4.0.1(postcss@8.4.24) @@ -987,7 +997,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 16.9.1 + '@types/node': 17.0.45 '@types/yargs': 16.0.5 chalk: 4.1.2 dev: true @@ -1837,7 +1847,7 @@ packages: yargs: 17.7.2 dev: true - /@netlify/build@29.12.1(@types/node@16.9.1): + /@netlify/build@29.12.1(@types/node@17.0.45): resolution: {integrity: sha512-ywXdJsCV/C+uBFTRM8Tc22gxd6E8cq0qbLMOAbID6N3BYKx6AFMaL8DkMFNmQOAYgb9AEfecRTAHmoFLBo/tVg==} engines: {node: ^14.16.0 || >=16.0.0} hasBin: true @@ -1891,7 +1901,7 @@ packages: supports-color: 9.3.1 terminal-link: 3.0.0 tmp-promise: 3.0.3 - ts-node: 10.9.1(@types/node@16.9.1)(typescript@5.0.4) + ts-node: 10.9.1(@types/node@17.0.45)(typescript@5.0.4) typescript: 5.0.4 uuid: 8.3.2 yargs: 17.7.2 @@ -2783,7 +2793,7 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.1 '@types/keyv': 3.1.4 - '@types/node': 16.9.1 + '@types/node': 17.0.45 '@types/responselike': 1.0.0 dev: true @@ -2820,7 +2830,7 @@ packages: /@types/http-proxy@1.17.11: resolution: {integrity: sha512-HC8G7c1WmaF2ekqpnFq626xd3Zz0uvaqFmBJNRZCGEZCXkvSdJoNFn/8Ygbd9fKNQj8UzLdCETaI0UWPAjK7IA==} dependencies: - '@types/node': 16.9.1 + '@types/node': 17.0.45 dev: true /@types/inquirer@8.2.6: @@ -2853,7 +2863,7 @@ packages: /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 16.9.1 + '@types/node': 17.0.45 dev: true /@types/liftoff@4.0.0: @@ -2885,6 +2895,9 @@ packages: /@types/node@16.9.1: resolution: {integrity: sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==} + /@types/node@17.0.45: + resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} + /@types/normalize-package-data@2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} dev: true @@ -2912,13 +2925,19 @@ packages: /@types/responselike@1.0.0: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} dependencies: - '@types/node': 16.9.1 + '@types/node': 17.0.45 dev: true /@types/retry@0.12.1: resolution: {integrity: sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==} dev: true + /@types/sax@1.2.4: + resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} + dependencies: + '@types/node': 17.0.45 + dev: false + /@types/scheduler@0.16.3: resolution: {integrity: sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==} dev: true @@ -2926,7 +2945,7 @@ packages: /@types/through@0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 16.9.1 + '@types/node': 17.0.45 dev: true /@types/triple-beam@1.3.2: @@ -2949,7 +2968,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 16.9.1 + '@types/node': 17.0.45 dev: true optional: true @@ -3569,7 +3588,7 @@ packages: astro: '>=0.26 || >=1.0.0-beta' dependencies: '@astropub/codecs': 0.4.4 - astro: 2.5.5(@types/node@16.9.1)(sharp@0.32.1) + astro: 2.5.5(@types/node@17.0.45)(sharp@0.32.1) file-type: 17.1.1 find-cache-dir: 3.3.2 find-up: 6.3.0 @@ -3583,7 +3602,7 @@ packages: resolution: {integrity: sha512-E+wJmxOnvBRjgzVctdGk/VdwoEqeQ6Q/KgVW2wRBXZWJVDgOweB32Da/UiH0/FpGncPzo2daOrc08DNn5wTanw==} dev: false - /astro@2.5.5(@types/node@16.9.1)(sharp@0.32.1): + /astro@2.5.5(@types/node@17.0.45)(sharp@0.32.1): resolution: {integrity: sha512-VRwnlfRtPALeOxfE4e7To5Vlu9pGwlTRWN1zkn1QTizwfg0rLirFTm6t2MCG/fUhlu/p3QO9tz8SpAIyDq53/Q==} engines: {node: '>=16.12.0', npm: '>=6.14.0'} hasBin: true @@ -3646,7 +3665,7 @@ packages: typescript: 5.0.4 unist-util-visit: 4.1.2 vfile: 5.3.7 - vite: 4.3.9(@types/node@16.9.1) + vite: 4.3.9(@types/node@17.0.45) vitefu: 0.2.4(vite@4.3.9) yargs-parser: 21.1.1 zod: 3.21.4 @@ -9307,7 +9326,7 @@ packages: resolution: {integrity: sha512-9iN1ka/9zmX1ZvLV9ewJYEk9h7RyRRtqdK0woXcqohu8EWIerfPUjYJPg0ULy0UqP7cslmdGc8xKDJcojlKiaw==} dev: true - /netlify-cli@15.4.1(@types/node@16.9.1): + /netlify-cli@15.4.1(@types/node@17.0.45): resolution: {integrity: sha512-IX4nDCkNlMwmTGKEs7kOfrzUjQikMxMQOpDr4PtjhTjQfaWylScBtXYl7gKygWA9KcfRpRa/oyRLZKiPBngVyA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -9315,7 +9334,7 @@ packages: dependencies: '@bugsnag/js': 7.20.2 '@fastify/static': 6.10.2 - '@netlify/build': 29.12.1(@types/node@16.9.1) + '@netlify/build': 29.12.1(@types/node@17.0.45) '@netlify/build-info': 7.0.5 '@netlify/config': 20.4.4 '@netlify/edge-bundler': 8.16.2 @@ -11964,6 +11983,17 @@ packages: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: false + /sitemap@7.1.1: + resolution: {integrity: sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==} + engines: {node: '>=12.0.0', npm: '>=5.6.0'} + hasBin: true + dependencies: + '@types/node': 17.0.45 + '@types/sax': 1.2.4 + arg: 5.0.2 + sax: 1.2.4 + dev: false + /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -12853,7 +12883,7 @@ packages: /ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} - /ts-node@10.9.1(@types/node@16.9.1)(typescript@5.0.4): + /ts-node@10.9.1(@types/node@17.0.45)(typescript@5.0.4): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -12872,7 +12902,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 16.9.1 + '@types/node': 17.0.45 acorn: 8.8.2 acorn-walk: 8.2.0 arg: 4.1.3 @@ -13330,7 +13360,7 @@ packages: vfile-message: 3.1.4 dev: false - /vite@4.3.9(@types/node@16.9.1): + /vite@4.3.9(@types/node@17.0.45): resolution: {integrity: sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -13355,7 +13385,7 @@ packages: terser: optional: true dependencies: - '@types/node': 16.9.1 + '@types/node': 17.0.45 esbuild: 0.17.19 postcss: 8.4.24 rollup: 3.23.0 @@ -13370,7 +13400,7 @@ packages: vite: optional: true dependencies: - vite: 4.3.9(@types/node@16.9.1) + vite: 4.3.9(@types/node@17.0.45) dev: false /vscode-css-languageservice@6.2.6: diff --git a/public/robots.txt b/public/robots.txt index f43a2c9..c749f5d 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,4 +1,4 @@ User-agent: * Allow: / -Sitemap: https://www.stefanimhoff.de/sitemap.xml +Sitemap: https://www.stefanimhoff.de/sitemap-index.xml Host: https://www.stefanimhoff.de/ diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 5dd4c77..3653f0b 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -80,6 +80,7 @@ const schema = JSON.stringify({ extend={{ link: [ { rel: 'stylesheet', href: '/assets/styles/print.css', media: 'print' }, + { rel: 'sitemap', href: '/sitemap-index.xml' }, { rel: 'icon', href: '/favicon.ico' }, { rel: 'icon',