From 22e67a0680f62adfb5e58e849e707dea6db18cdb Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sat, 9 Apr 2022 22:05:41 +0800 Subject: [PATCH] :sparkles: Feat: add user-defined content to menu items via the params field (#99) --- CHANGELOG.md | 7 +- exampleSite/config.toml | 20 +++- exampleSite/content/tests/highlight.md | 16 ++- exampleSite/content/tests/shortcodes.md | 13 ++ layouts/partials/header.html | 153 +++++++++++++----------- 5 files changed, 132 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index feba48ea..65db84d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 2b6e3df8..1f493892 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -83,6 +83,16 @@ enableEmoji = true url = "/categories/documentation/" title = "Theme Documentation" weight = 4 + [[languages.en.menu.main]] + identifier = "tests" + pre = "" + 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 = "" @@ -90,7 +100,7 @@ enableEmoji = true name = "Friends" url = "/friends/" title = "" - weight = 5 + weight = 6 [[languages.en.menu.main]] identifier = "about" pre = "" @@ -98,7 +108,7 @@ enableEmoji = true name = "About" url = "/about/" title = "" - weight = 6 + weight = 7 [[languages.en.menu.main]] identifier = "github" pre = "" @@ -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 主题" diff --git a/exampleSite/content/tests/highlight.md b/exampleSite/content/tests/highlight.md index 51e5882f..6c804a36 100644 --- a/exampleSite/content/tests/highlight.md +++ b/exampleSite/content/tests/highlight.md @@ -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: "" --- `inline code` diff --git a/exampleSite/content/tests/shortcodes.md b/exampleSite/content/tests/shortcodes.md index 4fb49a4a..46486a40 100644 --- a/exampleSite/content/tests/shortcodes.md +++ b/exampleSite/content/tests/shortcodes.md @@ -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: "" --- normal content diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a385b2d2..f62e02d6 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -41,37 +41,44 @@ {{- with .Page -}} {{- $url = .RelPermalink -}} {{- end -}} -