Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jan 8, 2024
1 parent 9ed6c5f commit 150611c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
35 changes: 22 additions & 13 deletions plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/toc.ts";
import image from "https://deno.land/x/[email protected]/image.ts";
import footnotes from "https://deno.land/x/[email protected]/footnotes.ts";
Expand All @@ -20,10 +21,27 @@ export interface Options {
prism?: Partial<PrismOptions>;
date?: Partial<DateOptions>;
pagefind?: Partial<PagefindOptions>;
feed?: Partial<FeedOptions>;
}

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())
Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/_includes/layouts/base.vto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png">
<link rel="canonical" href="{{ url |> url(true) }}">
<script src="/js/main.js" type="module"></script>
{{ it.extra_head || "" }}
{{ it.extra_head?.join("\n") }}
</head>
<body>
<nav class="navbar">
Expand Down

0 comments on commit 150611c

Please sign in to comment.