#2639·middleman

link_to not generating correct URLs when using i18n and directory_indexes

Author: jetxrCreated May 3, 2023Updated Jan 20, 2024
Labelsnotstale

Expected behavior and actual behavior

link_to does not generate correctly prefixed i18n URLs when using directory_indexes.

I somehow remember this working before. Has anything changed or was this always the case?

Steps to reproduce the problem (from a clean middleman installation)

Reproduced here: https://github.com/jetxr/mm-i18n-test/blob/main/source/localizable/index.html.erb

  • Followed steps in the docs to add i18n
  • Links with link_to are correctly generated with the locale prefixed when inside the locale's namespaced path
  • Add activate :directory_indexes to config.rb
  • Change link_to to target /page/index.html (or leave it page.html)
  • Links will lead to the root locale's page even when inside locale's namespaced path

Additional information

  • Not sure if this is similar to #1798, #1693

  • Doesn't seem like the tests have directory indexes enabled

  • Ruby version: 3.2.1

  • Middleman version: 4.4.3

  • OS version: macOS 13.3