Hi, I’m new to working with one-pagers and multiple languages and have a question that I’m sure is relatively simple. I began with the Kirby boiler plate one-page structure. I need to create section ids corresponding to a navigation that pull from each $pages title, (this way allowing language toggling between Korean and English.
Note that I use str::slug() here to make the title URL compatible. Please also note that this won’t work if you use hardcoded IDs in your sections, you would have to use the language specific IDs there as well.
Yes, with multiple languages, I’m trying to discern how to call the section IDs from the $page, opposed to hardcoded IDs (since I have both .kr.txt and .en.txt files for all $pages).
Unfortunately this solution doesn’t seem to work. The nav items appear in the proper language, but the links do not work. The URL returns empty for all the nav items.
Is it something to do with how my languages are configured?
It seems that if the nav is displaying properly for each language as an $item, then its a problem with the way the is linked. But it just seems like the item does not link properly:
That’s a bit weird, apart from the title, there’s also the slash missing. Are you sure you pasted the code exactly as above? (note that there was a > before url(), I have corrected it above)
Yes, but as I said, only if you use one-word titles and only if your titles only contain characters that are allowed in IDs (HTML5’s only restriction is spaces, though), otherwise you could end up with IDs like about us, and that’s not possible.
Yes of course, I understand. Everything is populating correctly and linked up, both for Korean and English.
Thanks so much for your patience and help with this.