Skip to content

Commit 69d9020

Browse files
committed
refactor: remove RTL configuration and streamline language direction detection
1 parent 9a165d7 commit 69d9020

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

_config.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ theme: jekyll-theme-chirpy
88
# otherwise, the layout language will use the default value of 'en'.
99
lang: en
1010

11-
# Force RTL mode for the entire website
12-
# When set to true, all pages will be rendered right-to-left
13-
# If you want to enable RTL mode for a specific page, add `rtl: true` to the front matter of that page
14-
rtl: false
15-
1611
# Change to your timezone › https://kevinnovak.github.io/Time-Zone-Picker
1712
timezone: Asia/Shanghai
1813

_includes/lang.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{% comment %}
2-
- Detect appearance language and return it through variable "lang"
3-
- Detect appearance language direction and return it through variable "dir"
2+
Detect appearance language and return it through variable "lang"
43
{% endcomment %}
54
{% if site.data.locales[page.lang] %}
65
{% assign lang = page.lang %}
@@ -9,9 +8,3 @@
98
{% else %}
109
{% assign lang = 'en' %}
1110
{% endif %}
12-
13-
{% assign dir = 'ltr' %}
14-
15-
{% if page.rtl || site.rtl %}
16-
{% assign dir = 'rtl' %}
17-
{% endif %}

_layouts/default.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
{% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %}
1313
{% endif %}
1414

15-
<!-- `lang` and `dir` attributes are set in _includes/lang.html -->
15+
{% assign _lang_code = lang | split: '-' | first %}
16+
{% assign dir = 'ltr' %}
17+
{% if "ar,fa,he,iw,ps,ug,ur,yi,ku" contains _lang_code %}
18+
{% assign dir = 'rtl' %}
19+
{% endif %}
20+
21+
<!-- `lang` attribute is set in _includes/lang.html -->
1622
<html lang="{{ lang }}" dir="{{ dir }}" {{ prefer_mode }}>
1723
{% include head.html %}
1824

_posts/2025-04-20-rtl-test-persian.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ image:
1212
lqip: data:image/webp;base64,UklGRpoAAABXRUJQVlA4WAoAAAAQAAAADwAABwAAQUxQSDIAAAARL0AmbZurmr57yyIiqE8oiG0bejIYEQTgqiDA9vqnsUSI6H+oAERp2HZ65qP/VIAWAFZQOCBCAAAA8AEAnQEqEAAIAAVAfCWkAALp8sF8rgRgAP7o9FDvMCkMde9PK7euH5M1m6VWoDXf2FkP3BqV0ZYbO6NA/VFIAAAA
1313
alt: نمایش واکنش‌گرای قالب Chirpy روی دستگاه‌های مختلف.
1414
lang: fa
15-
rtl: true
1615
---
1716

1817
## سرتیترها

0 commit comments

Comments
 (0)