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

Dinamic aliases #24

Closed Ran-n closed 2 years ago

Ran-n commented 2 years ago

Maybe this is something more suited for hugo itself, let me know your thoughts.

Right now Hugo makes it so you have to imput every alias one by one, which makes it very tedious and long. My idea is to be able to define variables in a way that by using them you get to have all the different combinations automatically. For example a long alias like this:

alias: [ '/gz/cousa/', '/gz/Cousa/', '/gz/cousá/, '/gz/Cousá/, '/cousa/', '/Cousa/', '/cousá/, '/Cousá/, ]

could become something like this:

alias: [ $lang: 'gz' $var: 'cousa' '/$lang/$var/', '/$var/' ]

And the variables would be iterated in any way possible and with any accent caracter. The specifics of the combination could be set in variables to have a more fine control.

kaiiiz commented 2 years ago

I think alias is treated as an array of strings in hugo. But in your proposed solution, alias is now mixed up with expressions and array items, which should be a template. I personally don't think hugo will accept this change since executing arbitrary template from user may bring security risks.