surjithctly / astroship

Astroship is a starter template for startups, marketing websites, landing pages & blog. Built with Astro & TailwindCSS
https://astroship.web3templates.com/
GNU General Public License v3.0
1.43k stars 349 forks source link

lack of base for submenu after deploying under subfolder of a domain #57

Closed guoapeng closed 1 month ago

guoapeng commented 1 month ago

when I access to submenu of the page, it reports page not found issue because of the submenu is based on root of the domain instead of subfoler of a domain when deploy astro as a subfolder of a domain.

for instance, my domain is pengtech.net and I deploy to git@github.com:guoapeng/astro.git as subfolder of https://pengtech.net, after that I can successfully access to https://pengtech.net/astro.

but when I clicking on blog menu, it is navigating me to https://pengtech.net/blog instead of https://pengtech.net/astro/blog.

I did configure the base in astro.config.mjs and then built the project. but that only take effect to the index page.

astro.config.mjs

// @ts-check
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import icon from "astro-icon";

// https://astro.build/config
export default defineConfig({
  site: "https://pengtech.net",
  base: 'astro',
  integrations: [tailwind(), mdx(), sitemap(), icon()],
});

to reproduce the issue, please visit the page https://pengtech.net/astro/ and click on any menu to see.

surjithctly commented 1 month ago

Hi,

you should change the href in the navmenu.astro to include your subpath as well.