You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When implementing multilingual themes, it would be useful to know the direction of the script the current page uses. For example, in the header.html template in the "hugo-zen-theme-rtl" theme, the following code is used to load styles for right-to-left scripts:
{{ if eq .Lang "ar" }}<link rel="stylesheet" href="/css/rtl.css">{{ end }}
If you want to test for more languages than just Arabic, this quickly becomes unwieldy. Instead, it would be nice to have Hugo define a page variable or similar so that you could do something like this:
{{ if eq .TextDirection "rtl" }}<link rel="stylesheet" href="/css/rtl.css">{{ end }}
You can already do something like this by setting a custom parameter for each language in your config.toml, but it would be better for the process to be automatic. And even if the process can't be automatic, it would be a good idea to have one established way of detecting text direction, so that if people switch themes RTL support will work without any adjustments to settings.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
When implementing multilingual themes, it would be useful to know the direction of the script the current page uses. For example, in the header.html template in the "hugo-zen-theme-rtl" theme, the following code is used to load styles for right-to-left scripts:
If you want to test for more languages than just Arabic, this quickly becomes unwieldy. Instead, it would be nice to have Hugo define a page variable or similar so that you could do something like this:
You can already do something like this by setting a custom parameter for each language in your config.toml, but it would be better for the process to be automatic. And even if the process can't be automatic, it would be a good idea to have one established way of detecting text direction, so that if people switch themes RTL support will work without any adjustments to settings.
The text was updated successfully, but these errors were encountered: