Hello, I’m trying to make a section and its pages to have different URLs based on the language that I’m currently on.
For example I wish to have a /portfolio-es/some_post.md
for the Spanish version and /portfolio-en/some_post.md
for the English version.
I found out that I can use the url
keyword in the front matter to override the URL and the layout
keyword to point to use a single layout (so I don’t have to repeat the portfolio-lang for each language) in the list page (by adding in the front matter on /portfolio/_index.html
). So now when I try to reach the Spanish version of the portfolio I get the url baseURL/es/portfolio-es
which is what I want.
Seems to work but when I try to reach the post from the list it points me to an /portfolio/some_post
, it skips the url
keyword that I added in the front matter.
Any idea how to fix this, or is there a way to do it even better?
Below is my project structure:
tree -I 'modules|static'
.
├── README.md
├── config.yaml
├── content
│ ├── en
│ │ ├── contact.html
│ │ └── portfolio
│ │ ├── _index.html
│ │ └── ceva.md
│ ├── es
│ │ ├── contact.html
│ │ └── portfolio
│ │ ├── _index.html
│ │ └── ceva.md
│ └── ro
│ ├── contact.html
│ └── portfolio
│ ├── _index.html
│ └── ceva.md
├── i18n
│ ├── en.yaml
│ ├── es.yaml
│ └── ro.yaml
├── resources
│ └── _gen
│ ├── assets
│ └── images
└── themes
└── hugo-personal-theme
├── LICENSE
├── README.md
├── archetypes
│ └── default.md
├── assets
│ ├── css
│ │ ├── styles.css
│ │ └── styles.css.map
│ └── js
│ └── dark-mode.js
├── layouts
│ ├── 404.html
│ ├── _default
│ │ ├── baseof.html
│ │ ├── contact.html
│ │ ├── list.html
│ │ └── single.html
│ ├── index.html
│ ├── partials
│ │ ├── blog-post-list-item.html
│ │ ├── components
│ │ │ ├── blog
│ │ │ │ └── blog_item.html
│ │ │ ├── projects
│ │ │ │ └── project_item.html
│ │ │ └── resume
│ │ │ └── resume.html
│ │ ├── dark-mode-switch.html
│ │ ├── footer.html
│ │ ├── head.html
│ │ ├── header.html
│ │ ├── pages
│ │ │ ├── blog
│ │ │ │ ├── _list.html
│ │ │ │ └── _single.html
│ │ │ ├── contact
│ │ │ │ └── _single.html
│ │ │ ├── portfolio
│ │ │ │ ├── _list.html
│ │ │ │ └── _single.html
│ │ │ └── resume
│ │ │ └── _single.html
│ │ ├── translations.html
│ │ └── util-fab.html
│ └── portfolio
│ ├── list.html
│ └── single.html
└── theme.toml
31 directories, 45 files