Translit slug
-
node-transliteration thanks @Mega
npm install transliteration
plugin index.js:
(function(module) { "use strict"; var mod = {}, translit = require('transliteration').slugify; mod.topicCreate = function(data, callback) { data.slug = translit(data.title, {lowercase: true, separator: '_'}); callback(null, data); }; mod.topicEdit = function(data, callback) { data.slug = translit(data.title, {lowercase: true, separator: '_'}); callback(null, data); }; module.exports = mod; }(module));
-
Please, anyone who is interested to join! https://github.com/NodeBB/NodeBB/issues/3097
-
I also interested in slugs with transliteration.
But, I think, It could be done from the plugin, main idea is to use hooks around create methods.Areas where It could be used:
- Topic titles
- Categories
- User names
I have 2 plugins in plans:
utils
- to reconstruct in-place slugs, for me It's easier to have lightweight utility, than very heavy import script;slugs
- I'm also not happy with Cyrillic letters in urlsP.S.
@julian slugs are really good candidate for core improvement -
@Nicolas Oh yeah, this shit messes up the indexing and Google search doesn't recognize the sitemap. I'm try use your plugin, but he not work with topic name.
Solved
To fix need changetopicData.slug = translit(topicData.slug)
totopicData.topic.slug = translit(topicData.topic.slug)