Is the "base" option from the Astro configuration supported? #17
-
I don't see anything in the documentation about this but I was wandering is the base option covered in this library because I am having problems making my application work with it? Here are some details about my app:
Here is how my config looks like import { defineConfig } from 'astro/config';
import { i18n, defaultLocaleSitemapFilter } from 'astro-i18n-aut/integration';
import lit from '@astrojs/lit';
import prefetch from '@astrojs/prefetch';
const defaultLocale = 'bg';
const locales = {
bg: 'bg-BG',
en: 'en-US',
};
// https://astro.build/config
export default defineConfig({
site: 'https://rumenpetrov.github.io',
output: 'static',
trailingSlash: 'always',
build: {
format: 'directory',
},
base: '/holiday-planner',
integrations: [
lit(),
prefetch(),
i18n({
locales,
// defaultLocale and redirectDefaultLocale are in middleware.js as well
defaultLocale,
redirectDefaultLocale: true,
}),
],
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
If you follow Astro convention, you should only have But, there may be a bug with the implementation. Do you have an example on GitHub I could take a look at? Maybe Or did you get it to work? I see https://github.com/rumenpetrov/holiday-planner hosted on https://rumenpetrov.github.io/holiday-planner/en/ seems to work fine. Astro does require you to prepend your links and urls manually: <a href="/docs/about/">About</a>
<img src=`${import.meta.env.BASE_URL}image.png`> |
Beta Was this translation helpful? Give feedback.
If you follow Astro convention, you should only have
.astro
pages in thepages
directory, which means that all of the import paths for images, content, and components should stay the same. I was careful to:srcDir
optionbase
optionBut, there may be a bug with the implementation. Do you have an example on GitHub I could take a look at? Maybe
injectPages
already prepends the base, so I don’t need to add it there.Or did you get it to work? I see https://github.com/rumenpetrov/holiday-planner hosted on https://rumenpetrov.github.io/holiday-planner/en/ seems to work fine.
Astro does require you to prepend your links and urls manually: