theNewDynamic / gohugo-theme-ananke

Ananke: A theme for Hugo Sites
https://gohugo-ananke-theme-demo.netlify.com/
MIT License
1.13k stars 1.14k forks source link

Added support for Right-To-Left languages #532

Closed MeirKriheli closed 2 years ago

netlify[bot] commented 2 years ago

Deploy Preview for gohugo-ananke-theme-demo canceled.

Name Link
Latest commit a5510f32a3f9b98a6b34affcef291957469c51a0
Latest deploy log https://app.netlify.com/sites/gohugo-ananke-theme-demo/deploys/625935beb3b1b80008fe2e31
regisphilibert commented 2 years ago

Hi @MeirKriheli this looks great thank you!

Do you have a repo with a language where this would apply? I'm curious to test it against the default

MeirKriheli commented 2 years ago

Not yet, I'm in the process of converting my blog from self written generator to Hugo, attached a couple of screenshots. Also working on adding Hebrew translation.

Here are some screenshots:

image image

How about me adding Hebrew content to exampleSite?

regisphilibert commented 2 years ago

How about me adding Hebrew content to exampleSite?

I'd rather not have to many languages in there, but I have my own sandbox where I stress test the theme with some edge cases, if you could share some hebrew md files with me, that would be great!

Thanks

MeirKriheli commented 2 years ago

Here's the WIP of the website I'm working on: https://github.com/MeirKriheli/meirkrihelicom

regisphilibert commented 2 years ago

Hi @MeirKriheli thanks for sharing this repo. I realize the languageDirection setting has only been introduced in Hugo 0.67.1. This theme currently as min version support of 64.

As a result running a previous version, $.Site.Language.LanguageDirection will break. We have several options:

The latter is great as updating the language direction evaluation logic will be very easy to update in the future.

Let me know if you need any pointer for the function but I guess {{ if ge hugo.Version "0.67.1" }} will be plenty.

Thanks!

MeirKriheli commented 2 years ago

@regisphilibert added language-direction partial. Is that what you had in mind?

regisphilibert commented 2 years ago

Thanks a lot, I revisited your logic a tiny bit without notifying you as was in a the middle of publishing a release and felt this had to be part of it.

I made the dir attribute only added if the languageDirection is explicitly set, so no user gets any surprise. https://github.com/theNewDynamic/gohugo-theme-ananke/commit/c49009b823de58ec21e4038eec91329cb538f8d2

Thanks a lot for your work!