nuejs / nue

A web framework for UX developers
https://nuejs.org
MIT License
6.04k stars 179 forks source link

Header items dissapear if they do not start with capital letter in site.yaml #358

Open goblinfactory opened 1 week ago

goblinfactory commented 1 week ago

Header items dissapear if they do not start with capital letter in site.yaml

  1. From starter simple-blog edit site.yaml, and alternatively set navigation item, "Emma Bennet" to "emma" or "Emma" and observe that the header item dissapears when it's not capitilised.
header:
  navigation:
    - emma Bennet: /
    - Contact: /contact/

footer:
  copyright:
    - © Emma Bennet: /

Environment

Minimal Reproduction

Logs & Additional Context

nobkd commented 1 week ago

Thanks for the bug report.

I'd suspect this line, but I haven't read through this code, so feel free to propose a fix yourself.

https://github.com/nuejs/nue/blob/c67208e8774f5e1b107dc5bd8f945f533c3afb1b/packages/nuekit/src/layout/navi.js#L16

goblinfactory commented 1 week ago

@nobkd that looks suspiciously like a convention over configuration where lowercase is reserved for Hidden items, perhaps javascript usage? before removing that line I'd chase down the original commit / author / blame etc and-or see if anyone can remember why it's like that? ;D

It's ok for now; however personally I'm a huge fan of lowercase text wherever possible and can expect that to come back and bite me later; regardless of whether we always use capital letters in link text or not, having that forced on us looks like a bad bug waiting to happen.

nobkd commented 1 week ago

@tipiirai did you do this, to have keys that are lowercase to stay keys and Uppercase items get transformed?

{faq: '/faq/'} -> {faq: '/faq'} {Faq: '/faq/'} -> {text: 'Faq', url: '/faq/'}

(It's always possible to use text-transform: lowercase, to have lowercase items in the nav...)