4.添加导航菜单

Answers to frequently asked questions.

将页面或链接添加到主菜单、社交菜单、文档菜单或页脚菜单。设置页面级别导航。 image image 在代码编辑器中打开。./config/_default/menus/menus.en.toml

全局导航

添加到主菜单

[[main]]
 name = "Docs"
 url = "/docs/overview/introduction/"
 weight = 10

[[main]]
 name = "Blog"
 url = "/blog/"
 weight = 20

[[main]]
 name = "Community"
 url = "https://github.com/h-enk/doks/discussions"
 weight = 50

添加到社交菜单

👉Doks 使用  Feather Icons

[[social]]
 name = "Twitter"
 pre = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-twitter\"><path d=\"M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z\"></path></svg>"
 url = "https://twitter.com/gethyas"
 weight = 10

[[social]]
 name = "GitHub"
 pre = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-github\"><path d=\"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22\"></path></svg>"
 url = "https://github.com/h-enk/doks"
 post = "v0.1.0"
 weight = 20

版块导航

添加到文档菜单

添加第一级菜单项(确保标识符是唯一的):

[[docs]]
 name = "overview"
 weight = 10
 identifier = "overview"
 url = "/docs/overview/"

[[docs]]
 name = "Recipes"
 weight = 20
 identifier = "how-to"
 url = "/docs/how-to/"

[[docs]]
 name = "Help"
 weight = 50
 identifier = "help"
 url = "/docs/help/"

通过引用第一级菜单项(使用其标识符),在文档页面的前面添加第二级菜单项:

..
menu:
 docs:
  parent: "overview"
  weight: 010
..

页面导航

设置级别

将自动生成“在此页上(目录)”部分。在中,设置要显示的级别(仅显示默认值和标题):./config/_default/markup.toml <h2> <h3>

[tableOfContents]
 endLevel = 3
 ordered = false
 startLevel = 2

页脚导航

添加到页脚菜单

[[footer]]
 name = "Privacy"
 url = "/privacy-policy/"
 weight = 10