Pelican is good project but slugify function is a little bit unuseful and not customizable. This problem will appear if you are a developer using multi-byte language. So we wanna exchange multi-byte words to alphabetical words caused by multi-byte url problem.
URL encoded word is not beautiful, Japanese word Otaku will change like this “%83I%83%5E%83N”. If we can use an URL containing only alphabets and other marks not multi-byte, we wanna do that.
Pelican try to automatically exchange it. But Japanese and some multi-byte languages are very complex that because they are having some pronounciations. This try will absolutely be failure and they make funny words we could not read it.
This plugin will help these situation. You can define some slugs for your categories like this:
CATEGORY_SLUGS = (
(u'オタク', u'otaku'),
(u'寿司', u'sushi'),
)
Another feature is that to define your slugify function like this:
def SLUG_FUNC(value, substitutions=()):
value = value.replace(u'禅', 'zen')
return value
These settings are on your pelicanconf.py then just work.
Installation
This plugin is not registered on PyPI. You should clone this repository and install through pip:
git clone git@github.com:wutali/pelican_slug.git cd pelican_slug pip install -e .
Configuration
Put this code on your pelicanconf.py and customize it:
PLUGINS = ['pelican_slug']
def SLUG_FUNC(value, substitutions=()):
# Do something you want.
return value
CATEGORY_SLUGS = (
(u'オタク', u'otaku'),
(u'寿司', u'sushi'),
)
License
Pelican Slug is released under the MIT License. http://www.opensource.org/licenses/mit-license
Release files for pelican_slug 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pelican_slug-0.1.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pelican_slug-0.1-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 6.5 kB
Release files / pelican_slug-0.1.tar.gz
| Download URL | pelican_slug-0.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3eecdd3ee73546c3c0103d12f19eef15becbf89ce7da1339fa414f23b58923c
|
|
BLAKE2b-256 checksum How to use checksums |
5ce8cd791a703b5ac4ab63a94ba9335224e216694ca7572492e8b2a392059ffc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pelican_slug-0.1-py2.7.egg
| Download URL | pelican_slug-0.1-py2.7.egg |
|---|---|
| Size | 3.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
3725a302ed0cbb602aa1fa6e0db30aae5c421ed57385e5deafa98ce6b3579c41
|
|
BLAKE2b-256 checksum How to use checksums |
7f14753e3cbb87ea132ca22b0c41066f932ea93aabd047e0e2634084eee66cbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |