bowman2001 / perplex

A Hugo theme to publish technical content (docs, news, blog, articles)
https://perplex.desider.at
Apache License 2.0
27 stars 11 forks source link

Dynamic top nav bar #168

Closed Kariton closed 4 months ago

Kariton commented 4 months ago

Hey,

can the top navigation bar be more dynamic? currently "NEWS DOCS BLOG ABOUT" seem to be static.

i would love to see the option to rename them and add more. especially something like a "on hover dropdown" menu thing.

so like:

DOCS
> big doc topic -> docs page as usual for that "big doc topic"
> another topic -> docs page as usual for "another topic"

to keep feature compatibility it could be hidden behind some "extended menu" flag.

extended_top_menu: true
top_menu:
  - title: "NEWS"
    path: none # -> default to /
    weight: 1
  - title: "DOCS"
    path: "doc"
    weight: 2
    children:
      - title: "big doc topic"
        path: "big_doc_topic"
        weight: 1
      - title: "another topic"
        path: "another_topic"
        weight: 2
[...]

the file structure should be self explanatory:

/content/doc/big_doc_topic/file.md 
/content/doc/big_doc_topic/folder/file.md 

same goes for urls:

http://localhost:1313/doc/big_doc_topic/file/
http://localhost:1313/doc/big_doc_topic/folder/file

where http://localhost:1313/doc/ is just a summary page like those for tags or categories.

bowman2001 commented 4 months ago

You can easily adapt the top navigation menu. But the menu structure for this theme is not configured in a central file (except for external links) and is using a menu entry in the top list page for the section you want to see in the top menu.

I would recommend reading https://perplex.desider.at/doc/site/navigation/.

We don't have to worry about the implementation of the file structure. Hugo does an excellent job when converting the Markdown content structure into the URL hierarchy. And you can configure nearly everything if you need some other structure than the default one.

Drop-down menus are not possible at the moment. Their configuration would be possible in the same way as described in the link above, but they are not implemented and this needs some work. I'm planning to include Alpine.js for this task. If this is an important feature, please add a feature request issue.