|
|
|
// https://astro.build/config
|
|
|
|
import sitemap from '@astrojs/sitemap';
|
|
|
|
import tailwind from '@astrojs/tailwind';
|
|
|
|
import node from '@astrojs/node';
|
|
|
|
import compress from 'astro-compress';
|
|
|
|
import { defineConfig } from 'astro/config';
|
|
|
|
import rehypeExternalLinks from 'rehype-external-links';
|
|
|
|
import { serializeSitemap, shouldIndexPage } from './sitemap.mjs';
|
|
|
|
|
|
|
|
import react from '@astrojs/react';
|
|
|
|
|
|
|
|
// https://astro.build/config
|
|
|
|
export default defineConfig({
|
|
|
|
site: 'https://roadmap.sh/',
|
|
|
|
markdown: {
|
|
|
|
shikiConfig: {
|
|
|
|
theme: 'dracula',
|
|
|
|
},
|
|
|
|
rehypePlugins: [
|
|
|
|
[
|
|
|
|
rehypeExternalLinks,
|
|
|
|
{
|
|
|
|
target: '_blank',
|
|
|
|
rel: function (element) {
|
|
|
|
const href = element.properties.href;
|
|
|
|
const whiteListedStarts = [
|
|
|
|
'/',
|
|
|
|
'#',
|
|
|
|
'mailto:',
|
|
|
|
'https://github.com/kamranahmedse',
|
|
|
|
'https://thenewstack.io',
|
|
|
|
'https://cs.fyi',
|
|
|
|
'https://roadmap.sh',
|
|
|
|
];
|
|
|
|
if (whiteListedStarts.some((start) => href.startsWith(start))) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
return 'noopener noreferrer nofollow';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// @FIXME:
|
|
|
|
// This should be "hybrid" but there is a bug in the current version of Astro
|
|
|
|
// that adds trailing slashes to the URLs when using "hybrid" mode.
|
|
|
|
// ----------------------------------------------
|
|
|
|
// https://github.com/withastro/astro/issues/7808
|
|
|
|
// ----------------------------------------------
|
|
|
|
// For now, we are using "server" mode and then using cloudfront to cache the
|
|
|
|
// pages and serve them as static.
|
|
|
|
output: 'server',
|
|
|
|
adapter: node({
|
|
|
|
mode: 'standalone',
|
|
|
|
}),
|
|
|
|
integrations: [
|
|
|
|
tailwind({
|
|
|
|
config: {
|
|
|
|
applyBaseStyles: false,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
sitemap({
|
|
|
|
filter: shouldIndexPage,
|
|
|
|
serialize: serializeSitemap,
|
|
|
|
}),
|
|
|
|
compress({
|
|
|
|
HTML: false,
|
|
|
|
CSS: false,
|
|
|
|
JavaScript: false,
|
|
|
|
}),
|
|
|
|
react(),
|
|
|
|
],
|
|
|
|
});
|