config.yaml
baseURL: https://example.com/myblog/
languageCode: en-us
defaultContentLanguage: en-us
menu:
main:
- name: Home
weight: 10
identifier: home
url: /
- name: Archives
weight: 40
identifier: archives
url: /archives/
languages:
zh-cn:
contentDir: content/zh-hans
title: 我的博客
languageName: 中文
en-us:
contentDir: content/en-us
title: My Blog
languageName: English
baseof.html
{{ range .Site.Menus.main -}}
{{- $url := .URL | relLangURL -}}
{{- $url -}}
{{- end }}
Output
localhost:1313/myblog/
/myblog/myblog/
/myblog/myblog/archives/
localhost:1313/myblog/zh-cn/
/myblog/zh-cn/myblog/
/myblog/zh-cn/myblog/archives/
Expected
localhost:1313/myblog/
/myblog/
/myblog/archives/
localhost:1313/myblog/zh-cn/
/myblog/zh-cn/
/myblog/zh-cn/archives/