Skip to content

Commit 546fc48

Browse files
committed
feat: add lume cms
1 parent b7dc4f9 commit 546fc48

17 files changed

+86
-29
lines changed

_cms.ts

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import site from '#data/site.ts'
2+
import lumeCMS from 'lume/cms/mod.ts'
3+
4+
const cms = lumeCMS({
5+
site,
6+
})
7+
8+
cms.collection({
9+
name: 'posts',
10+
description: 'Create, edit or delete the posts of the blog',
11+
store: 'src:posts/*.md',
12+
fields: [{
13+
name: 'title',
14+
type: 'text',
15+
label: 'Title of the page',
16+
attributes: {
17+
required: true,
18+
maxlength: 100,
19+
},
20+
}, {
21+
name: 'excerpt',
22+
type: 'text',
23+
label: 'Description displayed in post overview',
24+
attributes: {
25+
required: true,
26+
maxlength: 200,
27+
},
28+
}, {
29+
name: 'date',
30+
type: 'date',
31+
label: 'Published date',
32+
}, {
33+
name: 'draft',
34+
label: 'Draft',
35+
type: 'checkbox',
36+
description: 'If checked, the post will not be published.',
37+
}, {
38+
name: 'tags',
39+
type: 'list',
40+
label: 'Tags',
41+
init(field) {
42+
const { data } = field.cmsContent
43+
field.options = data.site?.search.values('tags')
44+
},
45+
}, {
46+
name: 'content',
47+
type: 'markdown',
48+
label: 'Page content',
49+
}],
50+
})
51+
52+
cms.upload('uploads: Uploaded files', 'src:assets/images/blog')
53+
54+
export default cms

deno.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"tasks": {
1111
"clean": "rm -rf ./_site",
12+
"cms": "BUILD_MODE=\"dev\" deno task lume cms",
1213
"build": "BUILD_MODE=\"prod\" deno task lume",
1314
"serve": "BUILD_MODE=\"dev\" deno task lume -s",
1415
"lume": "echo \"import 'lume/cli.ts'\" | deno run -A -"

import_map.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"imports": {
33
"lume/": "https://deno.land/x/[email protected]/",
4+
"lume/cms/": "https://cdn.jsdelivr.net/gh/lumeland/[email protected]/",
5+
"#data/": "./src/_data/",
46
"#plugins/": "./plugins/",
57
"#types": "./src/_includes/types.ts",
68
"#utils": "./src/_includes/utils/index.ts"

src/_data/site.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
2-
title: 'jrson.me',
2+
name: 'jrson.me',
33
description:
44
'I am a passionate web developer who likes to experiment with different stacks. I am forced to optimize things to infinity. I blog about my experience I like to share, using Node.js and Deno.',
55
url: 'https://jrson.me',

src/_includes/layouts/root.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default (
2-
{ children, comp, excerpt, importJs, site, title, type, url }: Lume.Data,
2+
{ children, comp, excerpt, importJs, site, title, type, url }: Lume.PageProps,
33
{ urlFilter }: Lume.Helpers,
44
) => {
55
const postSlug = title?.replace(/\s+/g, '-').toLowerCase()
@@ -18,7 +18,7 @@ export default (
1818
<head>
1919
<meta charSet='utf-8' />
2020
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
21-
<title>{`${title} - ${site.title}`}</title>
21+
<title>{`${title} - ${site.name}`}</title>
2222

2323
<meta name='supported-color-schemes' content='light dark' />
2424
<meta
@@ -55,18 +55,18 @@ export default (
5555
{/* @ts-ignore */}
5656
<link rel="stylesheet" nonce="CSP_NONCE" href={urlFilter!(`/styles.css`)} inline />
5757

58-
<meta name='title' content={`${title} - ${site.title}`} />
58+
<meta name='title' content={`${title} - ${site.name}`} />
5959
<meta name='description' content={excerpt || site.description} />
60-
<meta name='author' content={site.title} />
61-
<meta name='copyright' content={site.title} />
60+
<meta name='author' content={site.name} />
61+
<meta name='copyright' content={site.name} />
6262

6363
<meta name='robots' content='index,follow' />
6464
<meta name='google' content='nositelinkssearchbox' />
6565

6666
<meta property='og:type' content='website' />
67-
<meta property='og:site_name' content={site.title} />
67+
<meta property='og:site_name' content={site.name} />
6868
<meta property='og:locale' content={site.lang} />
69-
<meta property='og:title' content={`${title} - ${site.title}`} />
69+
<meta property='og:title' content={`${title} - ${site.name}`} />
7070
<meta
7171
property='og:description'
7272
content={excerpt || site.description}
@@ -86,7 +86,7 @@ export default (
8686
/>
8787
)}
8888

89-
<meta name='twitter:title' content={`${title} - ${site.title}`} />
89+
<meta name='twitter:title' content={`${title} - ${site.name}`} />
9090
<meta
9191
name='twitter:description'
9292
content={excerpt || site.description}
@@ -109,7 +109,7 @@ export default (
109109
<meta name='twitter:creator' content={site.twitter.user} />
110110
<meta name='twitter:site' content={site.twitter.user} />
111111

112-
<meta itemProp='name' content={site.title} />
112+
<meta itemProp='name' content={site.name} />
113113
<meta itemProp='url' content={urlFilter!('/', true)} />
114114
<meta itemProp='creator' content={site.author.name} />
115115

src/posts/2022-08-10_ path-aliases-with-import-maps-in-deno.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Path aliases with import maps on Deno
33
excerpt: A tiny guide how to resolve paths using path aliases with import maps on Deno.
4-
date: 2022-08-10 09:30:00
4+
date: 2022-08-10
55
draft: false
66
tags:
77
- deno

src/posts/2022-08-11_creating-a-blog-with-lume-part-1.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: "Creating a Blog with Lume Part 1: Install & config"
33
excerpt: This is a walkthrough of using Lume to set up a prerendered static blog with Preact, TypeScript, Markdown and SASS/SCSS.
4-
date: 2022-08-11 12:00:00
5-
updated: 2022-08-23 12:00:00
4+
date: 2022-08-11
5+
updated: 2022-08-23
66
draft: false
77
tags:
88
- deno

src/posts/2022-08-22_the-proper-way-to-create-a-dark-mode-switch.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: The proper way to create a Dark Mode Switch
33
excerpt: How to create a Dark Mode Switch wich is actually working.
4-
date: 2022-08-22 13:00:00
4+
date: 2022-08-22
55
draft: true
66
tags:
77
- css

src/posts/2022-09-08_creating-a-blog-with-lume-part-2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Creating a Blog with Lume Part 2: Pages & layouts"
33
excerpt: This is Part 2 of a walkthrough using Lume to set up a prerendered static blog with Preact, TypeScript, Markdown and SASS/SCSS.
4-
date: 2022-08-23 12:00:00
4+
date: 2022-08-23
55
draft: false
66
tags:
77
- deno

src/posts/2022-12-06_inertia.js-preact-adapter-v0.2.0-released.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Inertia.js Preact Adapter v0.2.0 released
33
excerpt: The Inertia.js Preact Adapter v0.2.0 is now available on npm!
4-
date: 2022-12-06 02:12:00
5-
update: 2022-12-08 20:45:00
4+
date: 2022-12-06
5+
update: 2022-12-08
66
draft: false
77
tags:
88
- inertiajs

src/posts/2022-12-08_update-on-the-current-inertia.js-state.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Update on the current Inertia.js state
33
excerpt: Updated information on the current state of Inertia.js packages.
4-
date: 2022-12-08 20:45:00
4+
date: 2022-12-08
55
draft: false
66
tags:
77
- inertiajs

src/posts/2023-01-29_how-to-format-and-lint-code-in-2023.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: How to Format and Lint code in 2023
33
excerpt: "Replace Prettier and ESLint now with a lightweight and faster alternative: Rome"
4-
date: 2023-01-29 05:00:00
5-
update: 2023-01-29 19:00:00
4+
date: 2023-01-29
5+
update: 2023-01-29
66
draft: false
77
tags:
88
- nodejs

src/posts/2023-01-30_website-speed-and-performance-optimization.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: 'Website Speed and Performance Optimization: Metrics & Tools'
33
excerpt: An insight into the optimization techniques I have applied to my blog.
4-
date: 2023-01-30 01:00:00
5-
update: 2023-08-02 19:00:00
4+
date: 2023-01-30
5+
update: 2023-08-02
66
draft: false
77
tags:
88
- html

src/posts/2023-08-02_bloodborne-isz-glitch-cure.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: 'Bloodborne Isz glitch Cure'
33
excerpt: This guide is intended to help Bloodborne players access the cure to Isz Glitch, that was discovered, but not widely distributed.
4-
date: 2023-08-02 19:00:00
5-
update: 2023-009-29 6:00:00
4+
date: 2023-08-02
5+
update: 2023-009-29
66
draft: false
77
tags:
88
- bloodborne

src/posts/2023-08-17_ps5-offline-exploit-host-with-bdjplus.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: PS5 offline exploit host with BDJPlus
33
excerpt: "Demonstration of PS5 offline exploit host with BDJPlus created by Euro Ali."
4-
date: 2023-08-17 19:00:00
4+
date: 2023-08-17
55
draft: false
66
tags:
77
- ps5
88
- jailbreak
9-
---
9+
---
1010

1111
Earlier this week, PS5Scene developer Euro Ali published some information
1212
regarding his concept of modifying the bd-j runtime to run existing bd-j

src/posts/2023-08-23_ how-to-copy-ps4-savegames-to-ps5-on-exploitable-consoles.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: How to copy PS4 savegames to PS5 on exploitable consoles
33
excerpt: "This guide is intended to help Bloodborne players migrating their savegames from an exploitable PS4 to an exploitable PS5."
4-
date: 2023-08-23 23:00:00
5-
update: 2023-08-24 6:00:00
4+
date: 2023-08-23
5+
update: 2023-08-24
66
draft: false
77
tags:
88
- ps4

src/posts/2023-10-03_how-to-use-forward-placeholders-and-extend-selectors-with-sass-scss-mixins-effectively.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "How to @use/@forward %placeholders and @extend selectors with SASS/SCSS @mixins effectively"
33
excerpt: "In this blog post we learn how to @use %placeholders in complex SASS/SCSS modules."
4-
date: 2023-10-03 23:00:00
4+
date: 2023-10-03
55
draft: false
66
tags:
77
- css

0 commit comments

Comments
 (0)