Skip to content

RTL version of Flex theme - a minimalist Pelican theme - with some new small features.

License

Notifications You must be signed in to change notification settings

AmirMahmood/Flex-RTL

 
 

Repository files navigation

Flex-RTL

RTL version of Flex theme - a minimalist Pelican theme - with some new small features.

Features

  • Change the direction of important tags to RTL.
  • Add support for using multiple custom JS/CSS files.
  • Add "featured-image" CSS class for styling featured images.

How to enable Persian translations?

At first clone the pelican-plugins repository and enable i18n for your pelican site by adding the following code to your pelicanconf.py:

# Enable i18n plugin, probably you already have some others here.
PLUGINS = ['i18n_subsites']
# Enable Jinja2 i18n extension used to parse translations.
JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n',]}

The step above only enable i18n, but it won't translate anything from English.

If you want to translate to another language you need to change DEFAULT_LANG and I18N_TEMPLATES_LANG in your pelicanconf.py. You should change LOCALE and OG_LOCALE to match your new configuration too.

To translate to Persian language you can add following code to your pelicanconf.py:

# Default theme language.
I18N_TEMPLATES_LANG = 'fa_IR'
# Your time zone.
TIMEZONE = 'Asia/Tehran'
# Your language.
DEFAULT_LANG = 'fa'
LOCALE = 'fa'

How to stop pelican from converting Persian tags and categories to Latin alphabet (Pinglish)?

when you add non ASCII or special characters in tags and categories, pelican converts them to ASCII characters or removes them. for example if you use سیب for tag, pelican converts it to sb or sib.

to stop this, find utils.py in pelican's site-packages folder. find slugify function and find this lines and comment out them:

value = unidecode(value)
# ...
value = value.encode('ascii', 'ignore')

change this line:

value = unicodedata.normalize('NFKD', value)

to:

value = unicodedata.normalize('NFKC', value)

and finally change this line:

return value.decode('ascii')

to:

return value.strip()

Attention: these changes may cause unexpected problems.

Thanks

Alexandre Vicenzi for Flex Theme - https://github.com/alexandrevicenzi/Flex

Pelican dev team for Pelican static site generator - https://github.com/getpelican/pelican

License

MIT

About

RTL version of Flex theme - a minimalist Pelican theme - with some new small features.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CSS 79.3%
  • HTML 16.2%
  • Shell 2.4%
  • Python 1.6%
  • JavaScript 0.5%