Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL languages support #115

Closed
nakibrayan3 opened this issue May 16, 2023 · 1 comment
Closed

RTL languages support #115

nakibrayan3 opened this issue May 16, 2023 · 1 comment

Comments

@nakibrayan3
Copy link

nakibrayan3 commented May 16, 2023

when i type text in Arabic (a RTL written language) it appear from the left to the right.

for this to work i need to add dir="rtl" to the <html> tag

<!DOCTYPE html>
<html dir="rtl" lang="ar">
<head>
<meta charset="utf-8">
...

edit: i learned how to fix it

  1. you need to edit layouts/_default/baseof.html

old line:

<html lang="{{ .Lang }}" itemscope itemtype="http:https://schema.org/WebPage">

new line:

<html dir="{{ if (isset .Site.Params "dir") }}{{ .Site.Params.dir }}{{ else }}ltr{{ end }}" lang="{{ .Lang }}" itemscope itemtype="http:https://schema.org/WebPage">
  1. and then add dir = "rtl" under [languages.ar] in the config.toml
[languages.ar]
    contentDir = "content/ar"
    weight = 1
    languageName = "Arabic"
    [languages.ar.params]
    introTitle = "some arabic text"
    introSubtitle = "another arabic text"
    introPhoto = "/picture.png"
    dir = "rtl"
@nakibrayan3
Copy link
Author

i have a pull request that fix this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant