Issues with multilingual linking

Hello, I’ve encountered an issue while working with HUGO in a multilingual setup. My objective is to create a link to the About page from both the main index.en.md and index.cs.md files in the following directory structure:

.
└── content
    ├── about
    |   ├── index.en.md <--- I want to link this
    |   └── index.cs.md
    ├── index.en.md <--- I am here
    └── index.cs.md

However, when I attempt to link to the page using either [about me]({{< ref "/about" >}}) or [about me]({{< ref "/about/index.en.md" >}}), I encounter the following error:

[en] REF_NOT_FOUND: Ref "/about": "/home/luketeam5/Desktop/personal (copy)/content/index.en.md:4:12": page not found
Rebuild failed:

Logged 1 error(s)

The only workaround I’ve found is to add an empty index.md file to the destination. This allows the link to work correctly, but it’s admittedly an inconvenient solution:

.
└── content
    ├── about
    |   ├── index.md <--- Dummy index.md
    |   ├── index.en.md <--- I want to link this
    |   └── index.cs.md
    ├── index.en.md <--- I am here
    └── index.cs.md
Technical details of my setup

$ hugo env =>

hugo v0.92.2+extended linux/amd64 BuildDate=2023-01-31T11:11:57Z VendorInfo=ubuntu:0.92.2-1ubuntu0.1
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.18.1"

Theme I use => The amazing hello-friend NG

I appreciate any help or advice you can offer. Thank you for your time!

If the directory tree in your post is accurate, you need to use _index.xx.md files in the content directory—it’s a section.

1 Like

Unfortunately, I’m still encountering the same error while trying to build the site:

[en] REF_NOT_FOUND: Ref "/about/_index.en.md": "/home/luketeam5/Desktop/personal (copy)/content/index.en.md:4:12": page not found
Rebuild failed:

Logged 1 error(s)

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

And the error message indicates that you did not rename the file.

3 Likes

Thank you, that solves the problem, sorry I didn’t notice :sweat_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.