jekyll-redirect-from icon indicating copy to clipboard operation
jekyll-redirect-from copied to clipboard

Use site or page language

Open me-and opened this issue 10 months ago • 3 comments

Rather than hard-code to use en-US, pick up the language tag from the page or site in the same way as the minima layout.

me-and avatar Feb 26 '25 17:02 me-and

Hello @me-and, this HTML page is actually the layout for generated redirect pages. Therefore, page.lang will always be undefined or null leading to unnecessary calls to the Liquid filter default. A better solution would be adding this attribute directly to the generated Redirect page via Ruby.

I recommend testing above hypothesis and solution using a sample site and make the necessary changes here.

ashmaroli avatar Feb 26 '25 18:02 ashmaroli

I had the impression that one could set page.lang in the same place as page.redirect.to, but I was just trying to get a quick fix when I spotted a redirect I'd created using GitHub Pages unexpectedly giving en-US as the language, so I could well be misunderstanding how these things fit together!

In any case, I'm not sufficiently invested to set up a test environment, so if this isn't a quick and helpful fix and nobody else wants to fix things properly, I'm happy to just drop it.

me-and avatar Feb 26 '25 18:02 me-and

Unfortunately yes, you have misunderstood the markup here. The generated redirect page(s) simply render an unstyled Redirecting... which is in en-US locale (or en lang).

So, if we were to interpolate page.lang to be say, fr_CA but still continue rendering Redirecting..., now that would be a bug / incorrect render.

ashmaroli avatar Feb 26 '25 19:02 ashmaroli