|
|
|
|
|
|
47
|
const flatPacked = []
|
47
|
const flatPacked = []
|
|
48
|
|
48
|
|
|
49
|
const storeTitle = letter => {
|
49
|
const storeTitle = letter => {
|
|
50
|
- if(seenTitles.includes(letter)) return
|
|
|
|
51
|
flatPacked.push({ slug: letter, title: letter, inbetween: true })
|
50
|
flatPacked.push({ slug: letter, title: letter, inbetween: true })
|
|
52
|
seenTitles.push(letter)
|
51
|
seenTitles.push(letter)
|
|
53
|
}
|
52
|
}
|
|
|
|
|
|
|
56
|
const lastWord = post.slug.split('-').filter(c => c).pop()
|
55
|
const lastWord = post.slug.split('-').filter(c => c).pop()
|
|
57
|
const firstCharaOflastWord = lastWord[0]
|
56
|
const firstCharaOflastWord = lastWord[0]
|
|
58
|
const firstCharaOfSortWord = post.sortname ? post.sortname[0] : 'z'
|
57
|
const firstCharaOfSortWord = post.sortname ? post.sortname[0] : 'z'
|
|
59
|
- const charaIndex = alphabet.indexOf(firstCharaOflastWord) < alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOflastWord) : alphabet.indexOf(firstCharaOfSortWord)
|
|
|
|
|
|
58
|
+ let charaIndex = alphabet.indexOf(firstCharaOflastWord) < alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOflastWord) : alphabet.indexOf(firstCharaOfSortWord)
|
|
|
|
59
|
+
|
|
|
|
60
|
+ // Kamaka problem
|
|
|
|
61
|
+ if(seenTitles.includes(letter)) {
|
|
|
|
62
|
+ charaIndex = alphabet.indexOf(firstCharaOflastWord) > alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOflastWord) : alphabet.indexOf(firstCharaOfSortWord)
|
|
|
|
63
|
+ }
|
|
60
|
|
64
|
|
|
61
|
storeTitle(alphabet[charaIndex])
|
65
|
storeTitle(alphabet[charaIndex])
|
|
62
|
flatPacked.push(post)
|
66
|
flatPacked.push(post)
|