Fix blog root URL

This commit is contained in:
Erica Marigold 2024-07-06 14:16:13 +05:30
parent 447d3dda73
commit c7959497ef
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -1,44 +1,44 @@
import tailwind from "@astrojs/tailwind" import sitemap from "@astrojs/sitemap";
import Compress from "astro-compress" import svelte from "@astrojs/svelte";
import icon from "astro-icon" import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config" import swup from "@swup/astro";
import Color from "colorjs.io" import Compress from "astro-compress";
import rehypeAutolinkHeadings from "rehype-autolink-headings" import icon from "astro-icon";
import rehypeKatex from "rehype-katex" import { defineConfig } from "astro/config";
import rehypeSlug from "rehype-slug" import Color from "colorjs.io";
import remarkMath from "remark-math" import rehypeAutolinkHeadings from "rehype-autolink-headings";
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs"
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs"
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs"
import remarkDirective from "remark-directive" /* Handle directives */
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
import rehypeComponents from "rehype-components"; /* Render the custom directive content */ import rehypeComponents from "rehype-components"; /* Render the custom directive content */
import svelte from "@astrojs/svelte" import rehypeKatex from "rehype-katex";
import swup from '@swup/astro'; import rehypeSlug from "rehype-slug";
import sitemap from '@astrojs/sitemap'; import remarkDirective from "remark-directive"; /* Handle directives */
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
import remarkMath from "remark-math";
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs";
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs";
import { parseDirectiveNode } from "./src/plugins/remark-directive-rehype.js"; import { parseDirectiveNode } from "./src/plugins/remark-directive-rehype.js";
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";
const oklchToHex = (str) => { const oklchToHex = str => {
const DEFAULT_HUE = 250 const DEFAULT_HUE = 250;
const regex = /-?\d+(\.\d+)?/g const regex = /-?\d+(\.\d+)?/g;
const matches = str.string.match(regex) const matches = str.string.match(regex);
const lch = [matches[0], matches[1], DEFAULT_HUE] const lch = [matches[0], matches[1], DEFAULT_HUE];
return new Color("oklch", lch).to("srgb").toString({ return new Color("oklch", lch).to("srgb").toString({
format: "hex", format: "hex",
}) });
} };
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
site: "https://fuwari.vercel.app/", site: "https://blog.devcomp.xyz/",
base: "/", base: "/",
trailingSlash: "always", trailingSlash: "always",
integrations: [ integrations: [
tailwind(), tailwind(),
swup({ swup({
theme: false, theme: false,
animationClass: 'transition-', animationClass: "transition-",
containers: ['main'], containers: ["main"],
smoothScrolling: true, smoothScrolling: true,
cache: true, cache: true,
preload: true, preload: true,
@ -60,11 +60,19 @@ export default defineConfig({
sitemap(), sitemap(),
], ],
markdown: { markdown: {
remarkPlugins: [remarkMath, remarkReadingTime, remarkGithubAdmonitionsToDirectives, remarkDirective, parseDirectiveNode], remarkPlugins: [
remarkMath,
remarkReadingTime,
remarkGithubAdmonitionsToDirectives,
remarkDirective,
parseDirectiveNode,
],
rehypePlugins: [ rehypePlugins: [
rehypeKatex, rehypeKatex,
rehypeSlug, rehypeSlug,
[rehypeComponents, { [
rehypeComponents,
{
components: { components: {
github: GithubCardComponent, github: GithubCardComponent,
note: (x, y) => AdmonitionComponent(x, y, "note"), note: (x, y) => AdmonitionComponent(x, y, "note"),
@ -73,7 +81,8 @@ export default defineConfig({
caution: (x, y) => AdmonitionComponent(x, y, "caution"), caution: (x, y) => AdmonitionComponent(x, y, "caution"),
warning: (x, y) => AdmonitionComponent(x, y, "warning"), warning: (x, y) => AdmonitionComponent(x, y, "warning"),
}, },
}], },
],
[ [
rehypeAutolinkHeadings, rehypeAutolinkHeadings,
{ {
@ -86,7 +95,7 @@ export default defineConfig({
tagName: "span", tagName: "span",
properties: { properties: {
className: ["anchor-icon"], className: ["anchor-icon"],
'data-pagefind-ignore': true, "data-pagefind-ignore": true,
}, },
children: [ children: [
{ {
@ -104,12 +113,15 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
onwarn(warning, warn) { onwarn(warning, warn) {
// temporarily suppress this warning // temporarily suppress this warning
if (warning.message.includes("is dynamically imported by") && warning.message.includes("but also statically imported by")) { if (
warning.message.includes("is dynamically imported by") &&
warning.message.includes("but also statically imported by")
) {
return; return;
} }
warn(warning); warn(warning);
} },
} },
}, },
css: { css: {
preprocessorOptions: { preprocessorOptions: {
@ -121,4 +133,4 @@ export default defineConfig({
}, },
}, },
}, },
}) });