diff --git a/astro.config.mjs b/astro.config.mjs index be2978b12..023f2a6e5 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,19 +1,34 @@ import { defineConfig } from 'astro/config'; +import { shouldIndexPage } from './src/lib/sitemap'; // https://astro.build/config -import tailwind from "@astrojs/tailwind"; +import tailwind from '@astrojs/tailwind'; import rehypeExternalLinks from 'rehype-external-links'; +// https://astro.build/config +import sitemap from '@astrojs/sitemap'; + // https://astro.build/config export default defineConfig({ + site: 'https://roadmap.sh', markdown: { rehypePlugins: [ - [rehypeExternalLinks, { target: '_blank'}] - ] + [ + rehypeExternalLinks, + { + target: '_blank', + }, + ], + ], }, - integrations: [tailwind({ - config: { - applyBaseStyles: false - } - })] + integrations: [ + tailwind({ + config: { + applyBaseStyles: false, + }, + }), + sitemap({ + filter: shouldIndexPage, + }), + ], }); \ No newline at end of file diff --git a/package.json b/package.json index d413d9bc7..d945f9e33 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "sync-content": "sh ./bin/sync-content.sh" }, "dependencies": { + "@astrojs/sitemap": "^1.0.0", "@astrojs/tailwind": "^2.1.3", "astro": "^1.8.0", "node-html-parser": "^6.1.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c81e3cf86..69596af4e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,6 +1,7 @@ lockfileVersion: 5.4 specifiers: + '@astrojs/sitemap': ^1.0.0 '@astrojs/tailwind': ^2.1.3 '@tailwindcss/typography': ^0.5.8 astro: ^1.8.0 @@ -13,6 +14,7 @@ specifiers: tailwindcss: ^3.2.4 dependencies: + '@astrojs/sitemap': 1.0.0 '@astrojs/tailwind': 2.1.3_tailwindcss@3.2.4 astro: 1.8.0 node-html-parser: 6.1.4 @@ -113,6 +115,13 @@ packages: prismjs: 1.29.0 dev: false + /@astrojs/sitemap/1.0.0: + resolution: {integrity: sha512-42GxuF5FP7RaKXZrwGLBLOX3hPv+Wl7ExJC43O0J5e34ojJkLeKf7QfwN1UwrJlqH0Ywi0Fm4/xGe482G09+wg==} + dependencies: + sitemap: 7.1.1 + zod: 3.20.2 + dev: false + /@astrojs/tailwind/2.1.3_tailwindcss@3.2.4: resolution: {integrity: sha512-W7UUUBJ3itDGcvJPvk+M/eNKFlLBYGODIzPsJ3zuehNzcJDhv/Ues+TzrpSvd0FaKfmV9Zlq3ZtToy96xxJU6Q==} peerDependencies: @@ -601,6 +610,10 @@ packages: '@types/unist': 2.0.6 dev: false + /@types/node/17.0.45: + resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} + dev: false + /@types/parse5/6.0.3: resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} dev: false @@ -609,6 +622,12 @@ packages: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} dev: false + /@types/sax/1.2.4: + resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} + dependencies: + '@types/node': 17.0.45 + dev: false + /@types/unist/2.0.6: resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} dev: false @@ -3084,6 +3103,10 @@ packages: dependencies: suf-log: 2.5.3 + /sax/1.2.4: + resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==} + dev: false + /section-matter/1.0.0: resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==} engines: {node: '>=4'} @@ -3151,6 +3174,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/4.0.0: resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} engines: {node: '>=12'} diff --git a/src/components/Footer.astro b/src/components/Footer.astro index b230df20c..882825f1c 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -34,7 +34,7 @@ import Icon from './Icon.astro';

diff --git a/src/components/Icon.astro b/src/components/Icon.astro index 1315be5c3..7e0f77483 100644 --- a/src/components/Icon.astro +++ b/src/components/Icon.astro @@ -1,8 +1,10 @@ --- import { parse } from 'node-html-parser'; +import type { Attributes } from 'node-html-parser/dist/nodes/html'; export interface Props { icon: string; + class?: string; } async function getSVG(name: string) { diff --git a/src/icons/construction.svg b/src/icons/construction.svg new file mode 100644 index 000000000..8e4764d7b --- /dev/null +++ b/src/icons/construction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lib/sitemap.ts b/src/lib/sitemap.ts new file mode 100644 index 000000000..edeebc183 --- /dev/null +++ b/src/lib/sitemap.ts @@ -0,0 +1,16 @@ +import type { SitemapItem } from '@astrojs/sitemap'; + +export function shouldIndexPage(page: string): boolean { + return ![ + 'https://roadmap.sh/404/', + 'https://roadmap.sh/terms/', + 'https://roadmap.sh/privacy/', + ].includes(page); +} + +export function serialize(item: SitemapItem): SitemapItem { + console.log(item); + return { + ...item, + }; +} diff --git a/src/pages/404.astro b/src/pages/404.astro new file mode 100644 index 000000000..0cdc82672 --- /dev/null +++ b/src/pages/404.astro @@ -0,0 +1,27 @@ +--- +import Icon from '../components/Icon.astro'; +import BaseLayout from '../layouts/BaseLayout.astro'; +--- + + +

+ +
+