Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.1k
Add RTL Support#2367
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Add RTL Support#2367
Conversation
zakariaf commentedApr 30, 2025
I'm running my Persian blog based on these changes, and it seems works perfectly.https://zakariafatahi.ir/ |
zakariaf commentedMay 6, 2025
hello@cotes2020 I just wanted to check if there’s anything else needed from my side to move this PR forward or if there are any concerns about merging it. |
cotes2020 commentedMay 11, 2025
Hi there, this is an excellent PR and thank you for your effort! Since there are quite a lot of changes, I’ll need to find some time to review it. Please don’t worry. |
cotes2020 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sorry for leaving this PR pending for so long. Here is my initial review:
Defining different webfonts for specific languages is too complex and will make the project harder to maintain. Therefore, for languages other than English, it's better to use the system's default fonts.
If you want to achieve automatic enabling of the RTL (right-to-left) attribute by intelligently identifying the language, then the configuration file does not need new settings. The Liquid code can identify which languages are RTL.
zakariaf commentedMay 20, 2025
Thank you for the review! Regarding the font: I agree it's better to keep things simple for maintainability. That said, the default English font renders quite poorly for RTL languages in practice. For now, I’ve removed the custom fonts as suggested, but I’ll experiment with a simpler approach in a future PR—likely by adding something like this to config.yml file: # Font Configurationfonts:# Base font for body textbase:["Source Sans Pro", "Microsoft Yahei", sans-serif]# Font for headingsheading:["Lato", "Microsoft Yahei", sans-serif]# Optional: Google Fonts to loadgoogle_fonts:# - "Roboto:400,700"# - "Montserrat:700" I'll open a separate PR for this to keep things clean. As for RTL detection via Liquid: I had tested that path, but couldn’t find a reliable way to automatically detect RTL languages purely within Liquid. I’ve simplified the implementation significantly in this PR to make it easier to manage. Thanks again! |
Nicolai9852 commentedMay 20, 2025
Hey@zakariaf I just saw your RTL - it looks really awesome! I did however notice one thing - not sure if it's intentional or not In the default LTR version, the button to copy the header link is right next to the title |
cotes2020 left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
... but couldn’t find a reliable way to automatically detect RTL languages purely within Liquid.
Use this code to automatically detect RTL:
{%assign_lang_code =lang |split:'-' |first %}{%-case_lang_code -%} {%-when'ar','fa','he','iw','kd','pk','ps','ug','ur','yi' -%} {%assigndir ='rtl' %}{%-endcase -%}Additionally, please move the newly added files in_data/locales to a separate PR. The file_posts/2025-04-20-rtl-test-persian.md doesn't need to be included in the repository either.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
zakariaf commentedMay 21, 2025
Hey@Nicolai9852, thanks for catching that! I think it was a mistake — I just fixed it. Appreciate you pointing it out! |
zakariaf commentedMay 21, 2025
@cotes2020 Thanks so much for the suggestions! I’ve applied all of them. Also, I just created another PR for the new locale files: |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
fix: add dir variables and update comments for clarity on language and direction detectionfix: update HTML lang and dir attributes to use correct language variables from lang.htmlfeat: add Persian RTL test post with comprehensive content and formattingfeat: add RTL font loader to support appropriate font loading based on page languagefeat: add RTL styles and font support for Arabic, Persian, and Urdu languagesfeat: enhance RTL support by adding additional languages to the configurationfix: remove pin attribute from Persian RTL test postfeat: add comprehensive RTL support documentationfix: update comment to clarify lang and dir attributes usage in HTML layoutfix: improve formatting of RTL content creation instructions in documentationfix: swap float directions for images in Persian RTL contentfix: remove duplicated font source and unicode-range for RTL fontsfix: update font weights for RTL language stylesheetsfix: add spaces to read time unit and prompt for better formattingfix: reorder RTL font loader inclusion for rendering after googlefontsfix: update RTL language configuration to use 'fa' instead of 'fa-IR' for better compatibilityfix: add transform to sidebar for better responsiveness in RTL layoutfix: add RTL Support feature to READMEfix: update RTL support comments for clarityfix: enhance RTL support documentation for clarity and usabilityfix: correct meta format in fa.yml for claritySigned-off-by: Zakaria Fatahi <zakaria@buzzjective.com>fix: improve sidebar transform handling for RTL layout in mobilerefactor: remove RTL font loader and associated styles for cleaner codebaserefactor: streamline RTL support configuration and enhance language direction detectionchore: remove obsolete RTL support documentationrefactor: remove RTL configuration and streamline language direction detectionchore: remove RTL support mention from READMErefactor: remove obsolete Persian RTL test post for cleaner codebaserefactor: adjust anchor float and margin for improved RTL stylingrefactor: remove rtl.scss from main.scss and move to _scss/baserefactor: revert all changes about locale filesfeat: dir is an optional attribute of html elementCo-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>Signed-off-by: Zakaria Fatahi <zakaria@buzzjective.com>refactor: add padding and border styles for access panel in RTLrefactor: adjust archive styles for improved RTL layoutfeat: add padding styles for categories in RTL layoutfeat: add margin styles for list items in page category for RTL layoutfeat: add margin styles for tag spans in RTL layout
cotes2020 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The search bar and the trending tags and TOC in the panel are still not vertically aligned. Please test each page locally first. Thank you!
- adjust margins for post-meta and post-tags- enhance page category and tag structure- fix category trigger rotate- adjust margin for .pin class
zakariaf commentedJun 4, 2025
I tried to check everything, I think all are fixed now. |
cotes2020 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the update! However, things might not be as fixed as you think. Here's a simple way to self-check if the RTL UI meets the expected standard: take a screenshot of each page in LTR mode, flip the image horizontally, and compare it with your RTL layout. The mismatches should be easy to spot.
Once you've addressed these more obvious UI issues, I'll be happy to take another look at the code in your PR.
kungfux commentedJul 19, 2025
FYI,CSS logical properties and values may help to reduce the need of overriding CSS rules for RTL support. |
758e22f to29bf95eComparehorotat commentedSep 1, 2025
Is this going to happen any time soon? |


Uh oh!
There was an error while loading.Please reload this page.
Add RTL Support to Jekyll Theme Chirpy
Type of change
Description
This PR adds comprehensive Right-to-Left (RTL) language support to the Chirpy theme. It enables the theme to automatically detect RTL languages and apply appropriate styling, making it accessible to users of Arabic, Kurdish, Persian, Urdu, and other RTL languages.
The implementation:
Important behavior to note: When viewing a page with an RTL language code (e.g.,
lang: fa,lang: arandrtl: true), the theme will automatically switch to RTL mode for that page and use the appropriate locale. This is standard behavior for internationalized websites and follows web accessibility best practices.Key components:
lang.htmlto detect RTL languagesrtl.scsswith comprehensive RTL stylingNew Files
_sass/rtl.scss: Contains RTL-specific styles for layout and UI elements_data/locales/: locale files as reference implementation:fa-IR.yml: Persian (Modified)ku-IQ.yml: Kurdish (Sorani)ur-PK.yml: Urdups-AF.yml: Pashtodv-MV.yml: Dhivehi_posts/2025-04-20-rtl-test-persian.md: Persian translation of the sample post(text-and-typography) showcasing all theme featuresModified Files
_sass/main.scss: Added import for rtl.scss_includes/lang.html: Added RTL detection logic_layouts/default.html: Added dir attribute to HTML tag_config.yml: Added RTL configuration optionsThis change enhances accessibility for millions of users worldwide who read and write in RTL languages without affecting any existing functionality.
Screenshots
Additional context
This implements a non-breaking enhancement that makes the theme more accessible to global users.
Note: The implementation requires a small addition to
head.htmlto include the RTL font loader, which I've documented in the PR.This closes the issue#1928 too