From 150611c014a6581f76d4e9b23efee94ab34b601b Mon Sep 17 00:00:00 2001 From: Oscar Otero Date: Mon, 8 Jan 2024 13:07:32 +0100 Subject: [PATCH] new version --- CHANGELOG.md | 6 ++++++ plugins.ts | 35 +++++++++++++++++++++------------- src/_data.yml | 1 + src/_includes/layouts/base.vto | 2 +- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c30f27b..975fdf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ 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.14.0] - 2024-01-08 +### Added +- Allow to configure the `feed` plugin. +- Changed `extra_head` variable to `stringArray`. + ## [0.13.3] - 2023-12-19 ### Fixed - Update markdown plugins for Lume 2. @@ -178,6 +183,7 @@ First version [#17]: https://github.com/lumeland/theme-simple-blog/issues/17 [#19]: https://github.com/lumeland/theme-simple-blog/issues/19 +[0.14.0]: https://github.com/lumeland/theme-simple-blog/compare/v0.13.3...v0.14.0 [0.13.3]: https://github.com/lumeland/theme-simple-blog/compare/v0.13.2...v0.13.3 [0.13.2]: https://github.com/lumeland/theme-simple-blog/compare/v0.13.1...v0.13.2 [0.13.1]: https://github.com/lumeland/theme-simple-blog/compare/v0.13.0...v0.13.1 diff --git a/plugins.ts b/plugins.ts index 2e5c88f..9246908 100644 --- a/plugins.ts +++ b/plugins.ts @@ -8,8 +8,9 @@ import resolveUrls from "lume/plugins/resolve_urls.ts"; import metas from "lume/plugins/metas.ts"; import pagefind, { Options as PagefindOptions } from "lume/plugins/pagefind.ts"; import sitemap from "lume/plugins/sitemap.ts"; -import feed from "lume/plugins/feed.ts"; +import feed, { Options as FeedOptions } from "lume/plugins/feed.ts"; import readingInfo from "lume/plugins/reading_info.ts"; +import { merge } from "lume/core/utils/object.ts"; import toc from "https://deno.land/x/lume_markdown_plugins@v0.7.0/toc.ts"; import image from "https://deno.land/x/lume_markdown_plugins@v0.7.0/image.ts"; import footnotes from "https://deno.land/x/lume_markdown_plugins@v0.7.0/footnotes.ts"; @@ -20,10 +21,27 @@ export interface Options { prism?: Partial; date?: Partial; pagefind?: Partial; + feed?: Partial; } +export const defaults: Options = { + feed: { + output: ["/feed.xml", "/feed.json"], + query: "type=post", + info: { + title: "=metas.site", + description: "=metas.description", + }, + items: { + title: "=title", + }, + }, +}; + /** Configure the site */ -export default function (options: Options = {}) { +export default function (userOptions?: Options) { + const options = merge(defaults, userOptions); + return (site: Lume.Site) => { site.use(postcss()) .use(basePath()) @@ -39,20 +57,11 @@ export default function (options: Options = {}) { .use(terser()) .use(pagefind(options.pagefind)) .use(sitemap()) - .use(feed({ - output: ["/feed.xml", "/feed.json"], - query: "type=post", - info: { - title: "=metas.site", - description: "=metas.description", - }, - items: { - title: "=title", - }, - })) + .use(feed(options.feed)) .copy("fonts") .copy("js") .copy("favicon.png") + .mergeKey("extra_head", "stringArray") .preprocess([".md"], (pages) => { for (const page of pages) { page.data.excerpt ??= (page.data.content as string).split( diff --git a/src/_data.yml b/src/_data.yml index f9e0377..23838f9 100755 --- a/src/_data.yml +++ b/src/_data.yml @@ -4,6 +4,7 @@ home: welcome: Hello, I am a person that writes stuff. menu_links: [] +extra_head: [] # Metas plugin https://lume.land/plugins/metas/#description metas: diff --git a/src/_includes/layouts/base.vto b/src/_includes/layouts/base.vto index df2f821..6f502e5 100644 --- a/src/_includes/layouts/base.vto +++ b/src/_includes/layouts/base.vto @@ -16,7 +16,7 @@ - {{ it.extra_head || "" }} + {{ it.extra_head?.join("\n") }}