Transliterate is a Grav plugin that converts accented characters to their ASCII equivalents. For example, 'Ä' will become 'A'.
Installing the Transliterate plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's terminal (also called the command line). From the root of your Grav install type:
bin/gpm install transliterate
This will install the Transliterate plugin into your /user/plugins
directory within Grav. Its files can be found under /your/site/grav/user/plugins/transliterate
.
To install this plugin, just download the zip version of this repository and unzip it under /your/site/grav/user/plugins
. Then, rename the folder to transliterate
. You can find these files on GitHub or via GetGrav.org.
You should now have all the plugin files under
/your/site/grav/user/plugins/transliterate
NOTE: This plugin is a modular component for Grav which requires Grav and the Error and Problems to operate.
Before configuring this plugin, you should copy the user/plugins/transliterate/transliterate.yaml
to user/config/plugins/transliterate.yaml
and only edit that copy.
The only available option is to enable or disable the filter:
enabled: true
To convert accented characters in a string to ASCII equivalents, use the `transliterate' filter:
{{ person.name|transliterate }}
Motör-Heäd Nylén will output Motor-Head Nylen and Đáç Århus outputs Dac Arhus.
If you want filename compatible versions of names, also remove whitespace and hyphenation with filename
filter:
{{ person.name|filename }}
This will convert Ján-Petter Novosić to janpetternovosic.
This is useful for example when you simply want to drop image files named firstnamelastname.jpg
into a Team member directory and have Grav automatically find them:
{% set image = page.media[person.name|filename ~ '.jpg'] %}