kaiiiz / hugo-theme-monochrome

Monochrome is a fast, clean and responsive hugo theme
https://kaiiiz.github.io/hugo-theme-monochrome/
MIT License
171 stars 52 forks source link

terms-cloud ordering #26

Closed Ran-n closed 11 months ago

Ran-n commented 2 years ago

When i create a taxonomy with contents like 1.8 1.9 1.10 etc the expected behaviour when using a terms-cloud would be to have them ordered like that. Instead, it shows them like 1.10 1.8 1.9

Ran-n commented 2 years ago

Ive checked the terms-cloud.html and you seem to use calculated $weight variable. Would it be possible to add a option to set each vale weight individually?

kaiiiz commented 2 years ago

When i create a taxonomy with contents like 1.8 1.9 1.10 etc the expected behaviour when using a terms-cloud would be to have them ordered like that. Instead, it shows them like 1.10 1.8 1.9

This is expected behavior since 1.8, 1.9, and 1.10 are strings. Sorting string is sequentially compared character by character. A compromise to this problem is that you should rename 1.8 to 1.08.

Ive checked the terms-cloud.html and you seem to use calculated $weight variable. Would it be possible to add a option to set each vale weight individually?

$weight is only used for calculating $fontSize, it does nothing about sorting.