#Overriding parts of the global Astro Config in a specific section of a site?

5 messages · Page 1 of 1 (latest)

potent heath
#

My personal website is a collection of small sub-sites that all have a radically different design and structure, intentionally.
It lives in single Astro project, so the sub-sites can share things like components, i find it a lot more convenient and would strongly prefer not to split to many separate projects.
E.g., i have /src/content/sub-site-1/, /src/layouts/sub-site-2/ that map to https://example.com/sub-site-1 and https://example.com/sub-site-2

Is there any safe and easy way to override some global configuration options from astro.config.mjs for specific sub-sites (maybe at the level of their base layout)?
I'd specifically like to have different ReMark settings for my MDX content collections / a different Shiki theme in specific sub-sites, for example, and i will probably want to do more things like that eventually.
There's a lot of magic in Astro so i don't really understand how these configuration options get passed around.

soft quarry
#

Hmm, a feature exactly as that is not available yet, but maybe in the future. As of now, what I do is use the same Astro code base and I use environment variables in Astro config, that way, I build the same astro code many times, but with different configs, e.g different base url and so on. Passed in environment variables.

potent heath
#

Thanks, I wouldn't be able to preview the entire site as-rendered from the dev server easily anymore unfortunately, so that'd be too handicapping a solution for me, i'm constantly tinkering with every section

potent heath
#

One partial alternative way to go about it would be to use a custom code component at the level of the layout, as documented here: https://blog.kizu.dev/astro-mdx-components/
Now to dig around and see if i can take this further

soft quarry
#

Glad you found a way out, although it's not a multi config solution, it's rare that single config is a problem and usually a solution like you suggest should work.