|
|
@@ -56,21 +56,8 @@ const _arrangeByAlpha = (postsList, seenTitles) => {
|
|
56
|
56
|
const lastWord = post.slug.split('-').filter(c => c).pop()
|
|
57
|
57
|
const firstCharaOflastWord = lastWord[0]
|
|
58
|
58
|
const firstCharaOfSortWord = post.sortname ? post.sortname[0] : 'z'
|
|
59
|
|
-
|
|
60
|
|
- let charaIndex = null
|
|
61
|
|
- let otherIndex = null
|
|
62
|
|
- const lastWordAlphaIndex = alphabet.indexOf(firstCharaOflastWord)
|
|
63
|
|
- const altWordAlphaIndex = alphabet.indexOf(firstCharaOfSortWord)
|
|
64
|
|
- if(lastWordAlphaIndex < altWordAlphaIndex) {
|
|
65
|
|
- charaIndex = lastWordAlphaIndex
|
|
66
|
|
- otherIndex = altWordAlphaIndex
|
|
67
|
|
- } else if (lastWordAlphaIndex > altWordAlphaIndex) {
|
|
68
|
|
- otherIndex = lastWordAlphaIndex
|
|
69
|
|
- charaIndex = altWordAlphaIndex
|
|
70
|
|
- }
|
|
71
|
|
- if(seenTitles.includes(alphabet[charaIndex])) {
|
|
72
|
|
- charaIndex = otherIndex
|
|
73
|
|
- }
|
|
|
59
|
+ const charaIndex = alphabet.indexOf(firstCharaOflastWord) < alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOflastWord) : alphabet.indexOf(firstCharaOfSortWord)
|
|
|
60
|
+
|
|
74
|
61
|
storeTitle(alphabet[charaIndex])
|
|
75
|
62
|
flatPacked.push(post)
|
|
76
|
63
|
})
|