Skip to content

Index routes are not taken into account #39

@BuckyBuck135

Description

@BuckyBuck135

Hi there!
I'm having a bit of an issue setting up localized URLs. I read the relevant config page, but I can't get to work.

Config

//astro.config.mjs
i18n({
      defaultLocale: "fr",
      locales: ["fr", "en"],
      pages: {
        "/portfolio/[slug]": {
            fr: "/nos-realisations/[slug]",
            en: "/our-work/[slug]"
        },
        "/about": {
            fr: "/a-propos",
            en: "/about"
        },
        "/blog/[slug]": {
            fr: "/le-blog/[slug]"
        }
    },
      client: {
        data: true,
      },
    }),

Folder structure

src/routes/
------------index.astro
------------about.astro
------------portfolio/
----------------------[slug].astro
----------------------index.astro
------------blog/
----------------------[slug].astro
----------------------index.astro

navigation data

I iterate over an array to create the nav links

const navData: NavItem[] = [
  {
    key: "home",
    url: "/",
  },
  {
    key: "our-work",
    url: "/portfolio/",
    children: []
  },
  {
    key: "blog",
    url: "/blog/",
    children: []
  },
]
export default navData

Image

Expected output: hitting /portfolio returns a localized url www.example.com/nos-realisations or www.example.com/our-work

What I get: no localization - hitting /portfolio returns www.example.com/portfolio, no matter the locale.

Thank you for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions