apvarun / blist-hugo-theme

Blist is a clean and fast blog theme for your Hugo site.

Home Page:https://blist.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RTL languages support

nakibrayan3 opened this issue · comments

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://schema.org/WebPage">

new line:

<html dir="{{ if (isset .Site.Params "dir") }}{{ .Site.Params.dir }}{{ else }}ltr{{ end }}" lang="{{ .Lang }}" itemscope itemtype="http://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"

i have a pull request that fix this problem