Is it possible to use cyrilic filenames with spaces for filesystem data collections? #877
-
Is it possible to use cyrilic filenames with spaces for filesystem data collections? I'm going to publish my growing markdown wiki via Pages, add joomla-hosted comments and so on. I would like to keep the original file naming like:
As I understand now, MD files should be placed to the data folder. Then I should create some wiki.html.php file that will produce article lists and seo and user frienly routes. Something like
Or I can fill out some slug field in the YAML of every article file. Before or after that I should somehow convert non-path'ed [[links]] to make them work. I'm still at the very beginning. Thank you for such cool Pages and even wiki about it! Your project is inspiring! Please, tell me some advises on how should I start. Yesterday I've got my first experience on php coding to make my prefered commenting system available on Pages, and now it's much more flexible via regexp url filtering. My first 27 lines of php code! If this succeeds, it can be a great use-case, I think. I would like to participate! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Glad to hear you are finding your way. and congrats on those first 27 lines of php code. This is how it all starts, one line of code at a time. Here is some feedback for you: 1. Loading external md filesThe best approach to load the 2. Handling slugsTwo possible approaches here, you can get the name of the file (see below) or you could add the slug to the frontmatter of your markdown file, then just grab it from there using the Data API. 3. Cyrilic filenames with spacesI haven't tested that but in theory this should just work. Pages is only loading the files, if your file system support cyrilic filenames with spaces then it should just be able to load them. Best to test that. The Data API transforms each file into a ComPagesDataObject which extends from: The data objects allows you to handle the data as an array, but also tap into the additional functions and features it offers, making the whole very powerful. A markdown data file, implements an additional: You should be able to do <?= data('/path/to/file.md')->getFilename() ?> Note this only works for 4. TransliterateThere are different ways you can handle the cyrilic file name in url's:
Or as part of our framework you have two filters:
in Pages you would do: Convert to ASCII uses the PHP Transliterator if available <?= slug('Вводная статья') ?> Convert to URL based on Joomla SEF settings use Joomla::stringURLSafe() <?= object('filter.alias')->sanitize('Вводная статья') ?> Note there is no See also: https://stackoverflow.com/questions/7461406/cyrillic-transliteration-in-php Happy coding. |
Beta Was this translation helpful? Give feedback.
-
Hello, Johan! Next, Also i tried |
Beta Was this translation helpful? Give feedback.
-
I'm not sure that I understood how to use it, but when I try
On the other hand I get what I need by this: ✅ That fits my needs on transliteration, so thank you for the tip! |
Beta Was this translation helpful? Give feedback.
Glad to hear you are finding your way. and congrats on those first 27 lines of php code. This is how it all starts, one line of code at a time. Here is some feedback for you:
1. Loading external md files
The best approach to load the
.md
files would indeed be to use the Data API. I have replied to your earlier question in detail here: #873 Also added some other options how this could work.2. Handling slugs
Two possible approaches here, you can get the name of the file (see below) or you could add the slug to the frontmatter of your markdown file, then just grab it from there using the Data API.
3. Cyrilic filenames with spaces
I haven't tested that but in theory this should just work. Pag…