mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
✨ Feat: add user-defined content to menu items via the params field (#99)
This commit is contained in:
+4
-3
@@ -5,9 +5,10 @@ All notable changes to this project will be documented in this file.
|
||||
## v0.2.14
|
||||
|
||||
- :recycle: Refactor: header layout
|
||||
- Add sub menu (nested menu) support ([#31](https://github.com/Lruihao/FixIt/issues/31))
|
||||
- Modified language selector to submenu (@pandaoh[`eced169`](https://github.com/Lruihao/FixIt/commit/eced169713ce4a0208ce70ab556824e47eb671d5), @Lruihao[#31](https://github.com/Lruihao/FixIt/issues/31))
|
||||
- Fix some header css bug ([#31](https://github.com/Lruihao/FixIt/issues/31))
|
||||
- :tada: Add sub menu (nested menu) support ([#31](https://github.com/Lruihao/FixIt/issues/31))
|
||||
- :sparkles: Feat: add user-defined content to menu items via the params field ([#99](https://github.com/Lruihao/FixIt/issues/99))
|
||||
- :sparkles: Modified language selector to submenu (@pandaoh[`eced169`](https://github.com/Lruihao/FixIt/commit/eced169713ce4a0208ce70ab556824e47eb671d5), @Lruihao[#31](https://github.com/Lruihao/FixIt/issues/31))
|
||||
- :bug: Fix some header css bug ([#31](https://github.com/Lruihao/FixIt/issues/31))
|
||||
- :zap: Perf: remove third-party library clipboard.js ([#84](https://github.com/Lruihao/FixIt/issues/84))
|
||||
- :pencil2: Docs: fix highlight url typo in `theme-documentation-built-in-shortcodes` (@d-baer[#85](https://github.com/Lruihao/FixIt/pull/85))
|
||||
- **Full Changelog:** @Lruihao [`v0.2.13...v0.2.14`](https://github.com/Lruihao/FixIt/compare/v0.2.13...v0.2.14)
|
||||
|
||||
+17
-3
@@ -83,6 +83,16 @@ enableEmoji = true
|
||||
url = "/categories/documentation/"
|
||||
title = "Theme Documentation"
|
||||
weight = 4
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "tests"
|
||||
pre = "<i class='fas fa-vials fa-fw fa-sm'></i>"
|
||||
post = ""
|
||||
name = "Tests"
|
||||
url = "/tests/"
|
||||
title = "Test for FixIt"
|
||||
weight = 5
|
||||
[languages.en.menu.main.params]
|
||||
draft = true
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "friends"
|
||||
pre = "<i class='fas fa-users fa-fw fa-sm'></i>"
|
||||
@@ -90,7 +100,7 @@ enableEmoji = true
|
||||
name = "Friends"
|
||||
url = "/friends/"
|
||||
title = ""
|
||||
weight = 5
|
||||
weight = 6
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "about"
|
||||
pre = "<i class='fas fa-info-circle fa-fw fa-sm'></i>"
|
||||
@@ -98,7 +108,7 @@ enableEmoji = true
|
||||
name = "About"
|
||||
url = "/about/"
|
||||
title = ""
|
||||
weight = 6
|
||||
weight = 7
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "github"
|
||||
pre = "<i class='fab fa-github fa-fw'></i>"
|
||||
@@ -106,7 +116,9 @@ enableEmoji = true
|
||||
name = ""
|
||||
url = "https://github.com/Lruihao/FixIt"
|
||||
title = "GitHub"
|
||||
weight = 7
|
||||
weight = 8
|
||||
[languages.en.menu.main.params]
|
||||
class = "text-center"
|
||||
[languages.en.params]
|
||||
# site description
|
||||
description = "About FixIt Theme"
|
||||
@@ -329,6 +341,8 @@ enableEmoji = true
|
||||
url = "https://github.com/Lruihao/FixIt"
|
||||
title = "GitHub"
|
||||
weight = 7
|
||||
[languages.zh-cn.menu.main.params]
|
||||
class = "text-center"
|
||||
[languages.zh-cn.params]
|
||||
# 网站描述
|
||||
description = "关于 FixIt 主题"
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
---
|
||||
title: "Highlight Code"
|
||||
title: "Highlight Test"
|
||||
date: 2022-02-27T18:45:22+08:00
|
||||
discription: "Test for code highlight feature"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- content
|
||||
- highlight
|
||||
categories:
|
||||
- Test
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Test for code highlight feature"
|
||||
parent: "tests"
|
||||
pre: "<i class='fas fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
`inline code`
|
||||
|
||||
@@ -1,8 +1,21 @@
|
||||
---
|
||||
title: "Shortcodes Test"
|
||||
date: 2022-03-07T22:31:22+08:00
|
||||
discription: "Test for shortcodes usages"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- shortcodes
|
||||
categories:
|
||||
- Test
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Test for shortcodes usages"
|
||||
parent: "tests"
|
||||
pre: "<i class='fas fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
normal content
|
||||
|
||||
@@ -41,37 +41,44 @@
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<li class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}"{{ if .HasChildren }} has-children{{ end }}>
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
{{- if (ne hugo.Environment "production") | or (ne .Params.Draft true) -}}
|
||||
<li
|
||||
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
|
||||
{{ if .HasChildren }}has-children{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
{{- if .HasChildren -}}
|
||||
<i class="dropdown-icon fas fa-chevron-down"></i>
|
||||
<ul class="sub-menu">
|
||||
{{ range .Children }}
|
||||
{{- $url := .URL | relLangURL -}}
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<li class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}">
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
{{- if .HasChildren -}}
|
||||
<i class="dropdown-icon fas fa-chevron-down"></i>
|
||||
<ul class="sub-menu">
|
||||
{{ range .Children }}
|
||||
{{- $url := .URL | relLangURL -}}
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<li
|
||||
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
</li>
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if .Site.Menus.main -}}
|
||||
<li class="menu-item delimiter"></li>
|
||||
@@ -198,48 +205,54 @@
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<li class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}">
|
||||
{{- if .HasChildren -}}
|
||||
<span class="nested-item">
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
<i class="dropdown-icon fas fa-chevron-right"></i>
|
||||
</span>
|
||||
<ul class="sub-menu">
|
||||
{{ range .Children }}
|
||||
{{- $url := .URL | relLangURL -}}
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<li class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}">
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- else -}}
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
{{- if (ne hugo.Environment "production") | or (ne .Params.Draft true) -}}
|
||||
<li
|
||||
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- if .HasChildren -}}
|
||||
<span class="nested-item">
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
<i class="dropdown-icon fas fa-chevron-right"></i>
|
||||
</span>
|
||||
<ul class="sub-menu">
|
||||
{{ range .Children }}
|
||||
{{- $url := .URL | relLangURL -}}
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<li
|
||||
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
|
||||
>
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- else -}}
|
||||
<a
|
||||
class="menu-link"
|
||||
href="{{ $url }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{ if (urls.Parse $url).Host }}rel="noopener noreffer" target="_blank"{{ end }}
|
||||
>
|
||||
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}{{ .Name }}{{ with .Post }} {{ . | safeHTML -}}{{- end -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<li class="menu-item theme-switch" title="{{ T "switchTheme" }}">
|
||||
<i class="fas fa-adjust fa-fw"></i>
|
||||
|
||||
Reference in New Issue
Block a user