Correct setting for archives in a multilingual website

In my config.toml I set the following lines:

[languages]
  [languages.en]
    title = "NicFab"
    languageName = "English"
    weight = 1
  [languages.it]
    title = "Il microblog NicFab"
    languageName = "Italian"
    weight = 2

    [[languages.en.menu.main]]
    name = "Home"
    pageref = "/"
    weight = 1
    [[languages.en.menu.main]]
    name = "About me"
    pageref = "/about"
    weight = 2
    [[languages.en.menu.main]]
    name = "Blog"
    url = "https://www.nicfab.it"
    weight = 3
    [[languages.en.menu.main]]
    name = "Privacy"
    pageref = "/privacypolicy"
    weight = 4
    [[languages.en.menu.main]]
    name = "Contacts"
    pageref = "/contact"
    weight = 5
    [[languages.en.menu.main]]
    name = "Archive"
    pageref = "archives"
    weight = 6
    [[languages.en.menu.main]]
    name = "Search"
    pageref = "/search"
    weight = 7
      

    [[languages.it.menu.main]]
    name = "Home"
    pageref = "/"
    weight = 1
    [[languages.it.menu.main]]
    name = "Chi sono"
    pageref = "/about.it"
    weight = 2
    [[languages.it.menu.main]]
    name = "Blog"
    url = "https://www.nicfab.it"
    weight = 3
    [[languages.it.menu.main]]
    name = "Privacy"
    pageref = "/privacypolicy.it"
    weight = 4
    [[languages.it.menu.main]]
    name = "Contatti"
    pageref = "/contact.it"
    weight = 5
    [[languages.it.menu.main]]
    name = "Archive"
    pageref = "archives.it"
    weight = 6
    [[languages.it.menu.main]]
    name = "Cerca"
    pageref = "/search.it"
    weight = 7

In /content I put 2 files: archive.md and archive.it.md
Both those files have the following declaration:

---
title: "Archive"
layout: "archives"
url: "/archives/"
summary: archives
---

In local archives works only for one language (English), and not for Italian.
Where am I wrong?

Each page needs a unique url.
The url parameter overrides the default permalink.
Currently both pages use the same url.
You only see the english version generated because that is the 1st language encountered by Hugo.
Are you sure that you need to set url manually?

Thank you.
I would like to find a solution to have a multilingual website with an Archive feature for each language.
Indeed, if I set the archives as /archives/ for both English and Italian, it will show only the Italian posts.
I don’t know.
Is it possible to have the Archive feature for both English and Italian?
How can I do?

https://gohugo.io/content-management/urls/#set-url-in-front-matter

From Hugo 0.55, you can use URLs relative to the current site context (the language), which makes it simpler to maintain.

url: "archives/"  <-- no leading slash
1 Like

Thank you.
I have in /content all the pages (in English with extension .md and in Italian with extension .it.md).
Always in /content I have two folders:

  1. post (with all the posts in English)
  2. post_it (with all the posts in Italian)
    Can I use url: "archives/" in the file archives.it.md?

Sorry for my previous post.
I tried and it works properly!
Thank you very much

Just another question: having the menu configuration as you see above, can I set a drop-down menu even for one of the voices?
I can open another ticket if it’s necessary.

Yeah, that one.

1 Like

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