Skip to content

Commit 3d7ce19

Browse files
authored
RSS feed for Magazine (#80)
1 parent abbf3ec commit 3d7ce19

14 files changed

+93
-2
lines changed

apps/website/docs/.vitepress/config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { defineConfig } from 'vitepress';
22
import { createSidebar } from './sidebar_creator';
3+
import { rss } from './rss';
34

45
export default defineConfig({
5-
lang: 'en-US',
6+
async buildEnd(config) {
7+
await rss.onBuildEnd(config);
8+
},
9+
lang: 'en',
610
title: 'With Ease',
711
description:
812
'A set of libraries and recipes to make frontend development easier thanks to Effector',
@@ -19,7 +23,7 @@ export default defineConfig({
1923
logo: '/logo.svg',
2024
footer: {
2125
message: 'Released under the MIT License.',
22-
copyright: 'Copyright © 2023-present Igor Kamyşev',
26+
copyright: 'Copyright © 2023-present, Igor Kamyşev',
2327
},
2428
socialLinks: [
2529
{ icon: 'github', link: 'https://github.com/igorkamyshev/withease' },

apps/website/docs/.vitepress/rss.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import path from 'node:path';
2+
import { writeFile } from 'node:fs/promises';
3+
import { Feed } from 'feed';
4+
import { createContentLoader } from 'vitepress';
5+
import { compareAsc } from 'date-fns';
6+
7+
export const rss = {
8+
async onBuildEnd(config) {
9+
const hostname = 'https://withease.pages.dev';
10+
11+
const feed = new Feed({
12+
title: 'With Ease Magazine',
13+
description:
14+
'The collection of articles about Effector and related topics. It is not a replacement for the official documentation, but it can help you to understand some concepts better.',
15+
id: hostname,
16+
link: hostname,
17+
language: 'en',
18+
favicon: `${hostname}/favicon.ico`,
19+
copyright: 'Copyright (c) 2023-present, Igor Kamyşev',
20+
});
21+
22+
const pages = await createContentLoader('/magazine/*.md', {
23+
excerpt: true,
24+
render: true,
25+
}).load();
26+
27+
const posts = pages.filter((page) => page.frontmatter.rss ?? true);
28+
29+
posts.sort((a, b) => compareAsc(b.frontmatter.date, a.frontmatter.date));
30+
31+
for (const { url, excerpt, frontmatter, html } of posts) {
32+
feed.addItem({
33+
title: frontmatter.title,
34+
id: `${hostname}${url}`,
35+
link: `${hostname}${url}`,
36+
description: excerpt,
37+
content: html,
38+
author: [],
39+
date: frontmatter.date,
40+
});
41+
}
42+
43+
await writeFile(path.join(config.outDir, 'feed.rss'), feed.rss2());
44+
},
45+
};

apps/website/docs/magazine/dependency_injection.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Dependency injection
3+
date: 2023-06-19
34
---
45

56
# Dependency injection

apps/website/docs/magazine/explicit_start.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Explicit start of the app
3+
date: 2024-01-26
34
---
45

56
# Explicit start of the app

apps/website/docs/magazine/fork_api_rules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Fork API rules
3+
date: 2024-01-26
34
---
45

56
# Fork API rules

apps/website/docs/magazine/global_variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Global variables
3+
date: 2023-01-02
34
---
45

56
# Global variables

apps/website/docs/magazine/handle_events_in_ui_frameworks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
outline: [2, 3]
33
title: Handle Effector's Events in UI-frameworks
4+
date: 2024-01-26
45
---
56

67
# Handle Effector's _Events_ in UI-frameworks

apps/website/docs/magazine/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
sidebar: false
3+
rss: false
34
---
45

56
# Magazine

apps/website/docs/magazine/migration_from_redux.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Migrating from Redux to Effector
3+
date: 2024-03-08
4+
---
5+
16
# Migrating from Redux to Effector
27

38
This guide explains how to perform a gradual, non-blocking code migration from Redux to Effector.

apps/website/docs/magazine/no_domains.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: You Don't Need Domains
3+
date: 2024-01-26
34
---
45

56
# You Don't Need Domains

apps/website/docs/magazine/no_methods.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Prefer Operators to Methods
3+
date: 2024-01-26
34
---
45

56
# Prefer Operators to Methods

apps/website/docs/magazine/watch_calls.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: .watch calls are (not) weird
3+
date: 2024-01-26
34
---
45

56
# `.watch` calls are (not) weird

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"effector": "23.0.0",
4545
"effector-vue": "23.0.0",
4646
"eslint": "8.46.0",
47+
"feed": "^4.2.2",
4748
"glob": "^8.0.3",
4849
"i18next": "23.0.0",
4950
"nx": "16.5.x",
@@ -65,6 +66,7 @@
6566
},
6667
"dependencies": {
6768
"@algolia/client-search": "^4.14.3",
69+
"date-fns": "^3.6.0",
6870
"sandpack-vue3": "^3.1.7"
6971
}
7072
}

pnpm-lock.yaml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)