From bbcd26e301ca89ad3cf59598e25b6c809b4f7caf Mon Sep 17 00:00:00 2001 From: Oscar Otero Date: Mon, 12 Aug 2024 20:32:40 +0200 Subject: [PATCH] new version --- CHANGELOG.md | 5 +++-- _cms.ts | 37 +++++++++++++++++++++++++++----- deno.json | 5 +++-- plugins.ts | 12 +++++++++++ src/_data.yml | 1 + src/_includes/css/menu.css | 12 +++++++++++ src/_includes/templates/menu.vto | 9 ++++++++ 7 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 src/_data.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 456c8e0..b47b32b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [0.9.3] - Unreleased +## [0.9.3] - 2024-08-12 ### Added - Settings to CMS to configure a default extra_head and language. +- New option to include additional links in the navbar. ## [0.9.2] - 2024-08-08 ### Added @@ -141,7 +142,7 @@ First version [#8]: https://github.com/lumeland/theme-simple-wiki/issues/8 [#9]: https://github.com/lumeland/theme-simple-wiki/issues/9 -[0.9.3]: https://github.com/lumeland/theme-simple-wiki/compare/v0.9.2...HEAD +[0.9.3]: https://github.com/lumeland/theme-simple-wiki/compare/v0.9.2...v0.9.3 [0.9.2]: https://github.com/lumeland/theme-simple-wiki/compare/v0.9.1...v0.9.2 [0.9.1]: https://github.com/lumeland/theme-simple-wiki/compare/v0.9.0...v0.9.1 [0.9.0]: https://github.com/lumeland/theme-simple-wiki/compare/v0.8.2...v0.9.0 diff --git a/_cms.ts b/_cms.ts index e788ffc..b9008ca 100644 --- a/_cms.ts +++ b/_cms.ts @@ -15,22 +15,49 @@ cms.document( ], ); -cms.document( - "settings: Global settings for the site", - "src:_data.yml", - [ +cms.document({ + name: "Settings", + description: "Global settings for the site", + store: "src:_data.yml", + url: "/", + fields: [ { name: "lang", type: "text", label: "Language", + description: "The language of the site", }, { name: "extra_head", type: "code", description: "Extra content to include in the tag", }, + { + name: "menu_links", + type: "object-list", + description: "Extra links to include in the main menu", + fields: [ + { + name: "text", + type: "text", + label: "Text", + }, + { + name: "href", + type: "text", + label: "URL", + }, + { + name: "icon", + type: "text", + label: "Icon", + description: + "A Phosphor icon name", + }, + ], + }, ], -); +}); cms.collection( "pages: All pages of the site", diff --git a/deno.json b/deno.json index 15cae06..592c4b9 100644 --- a/deno.json +++ b/deno.json @@ -1,14 +1,15 @@ { "imports": { "lume/": "https://deno.land/x/lume@v2.2.4/", - "lume/cms/": "https://cdn.jsdelivr.net/gh/lumeland/cms@v0.3.10/" + "lume/cms/": "https://cdn.jsdelivr.net/gh/lumeland/cms@v0.5.9/" }, "lock": false, "tasks": { "lume": "echo \"import 'lume/cli.ts'\" | deno run -A -", "build": "deno task lume", "serve": "deno task lume -s", - "update-deps": "deno run -A 'https://deno.land/x/nudd@v0.2.0/cli.ts' update deno.json" + "cms": "deno task lume cms", + "update-deps": "deno run -A 'https://deno.land/x/nudd@v0.2.8/cli.ts' update deno.json" }, "compilerOptions": { "types": [ diff --git a/plugins.ts b/plugins.ts index 069bc95..405199b 100644 --- a/plugins.ts +++ b/plugins.ts @@ -9,6 +9,9 @@ import prism from "lume/plugins/prism.ts"; import date from "lume/plugins/date.ts"; import basePath from "lume/plugins/base_path.ts"; import favicon, { Options as FaviconOptions } from "lume/plugins/favicon.ts"; +import phosphor, { + Options as IconOptions, +} from "https://deno.land/x/lume_icon_plugins@v0.2.3/phosphor.ts"; import { alert } from "npm:@mdit/plugin-alert@0.8.0"; import "lume/types.ts"; @@ -18,6 +21,11 @@ export interface Options { * Options for the favicon plugin. */ favicon?: FaviconOptions; + + /** + * Options for the phosphor plugin. + */ + icons?: IconOptions; } export default function (options: Options = {}) { @@ -33,6 +41,10 @@ export default function (options: Options = {}) { .use(date()) .use(favicon(options.favicon)) .use(basePath()) + .use(phosphor({ + ...options.icons, + name: "icon", + })) .data("layout", "layout.vto") .data("date", "Git Last Modified") .data("order", 0) diff --git a/src/_data.yml b/src/_data.yml new file mode 100644 index 0000000..6daa756 --- /dev/null +++ b/src/_data.yml @@ -0,0 +1 @@ +menu_links: [] diff --git a/src/_includes/css/menu.css b/src/_includes/css/menu.css index bda136c..7bdf3ff 100644 --- a/src/_includes/css/menu.css +++ b/src/_includes/css/menu.css @@ -110,6 +110,18 @@ color: var(--color-base); background-color: var(--color-line); } + + .menu-custom { + display: flex; + align-items: center; + column-gap: 8px; + + svg { + width: 20px; + height: 20px; + fill: var(--color-base); + } + } } [data-theme="dark"] { diff --git a/src/_includes/templates/menu.vto b/src/_includes/templates/menu.vto index 30bc40f..7c7c679 100644 --- a/src/_includes/templates/menu.vto +++ b/src/_includes/templates/menu.vto @@ -15,5 +15,14 @@ {{ include "templates/menu_item.vto" { item } }} {{ /for }} + + {{- for link of menu_links }} +
  • + + {{ link.icon |> icon }} + {{ link.text }} + +
  • + {{ /for }}