Skip to content

Commit

Permalink
RSS feed for Magazine (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev authored Apr 11, 2024
1 parent abbf3ec commit 3d7ce19
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/website/docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { defineConfig } from 'vitepress';
import { createSidebar } from './sidebar_creator';
import { rss } from './rss';

export default defineConfig({
lang: 'en-US',
async buildEnd(config) {
await rss.onBuildEnd(config);
},
lang: 'en',
title: 'With Ease',
description:
'A set of libraries and recipes to make frontend development easier thanks to Effector',
Expand All @@ -19,7 +23,7 @@ export default defineConfig({
logo: '/logo.svg',
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2023-present Igor Kamyşev',
copyright: 'Copyright © 2023-present, Igor Kamyşev',
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/igorkamyshev/withease' },
Expand Down
45 changes: 45 additions & 0 deletions apps/website/docs/.vitepress/rss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import path from 'node:path';
import { writeFile } from 'node:fs/promises';
import { Feed } from 'feed';
import { createContentLoader } from 'vitepress';
import { compareAsc } from 'date-fns';

export const rss = {
async onBuildEnd(config) {
const hostname = 'https://withease.pages.dev';

const feed = new Feed({
title: 'With Ease Magazine',
description:
'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.',
id: hostname,
link: hostname,
language: 'en',
favicon: `${hostname}/favicon.ico`,
copyright: 'Copyright (c) 2023-present, Igor Kamyşev',
});

const pages = await createContentLoader('/magazine/*.md', {
excerpt: true,
render: true,
}).load();

const posts = pages.filter((page) => page.frontmatter.rss ?? true);

posts.sort((a, b) => compareAsc(b.frontmatter.date, a.frontmatter.date));

for (const { url, excerpt, frontmatter, html } of posts) {
feed.addItem({
title: frontmatter.title,
id: `${hostname}${url}`,
link: `${hostname}${url}`,
description: excerpt,
content: html,
author: [],
date: frontmatter.date,
});
}

await writeFile(path.join(config.outDir, 'feed.rss'), feed.rss2());
},
};
1 change: 1 addition & 0 deletions apps/website/docs/magazine/dependency_injection.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Dependency injection
date: 2023-06-19
---

# Dependency injection
Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/magazine/explicit_start.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Explicit start of the app
date: 2024-01-26
---

# Explicit start of the app
Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/magazine/fork_api_rules.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Fork API rules
date: 2024-01-26
---

# Fork API rules
Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/magazine/global_variables.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Global variables
date: 2023-01-02
---

# Global variables
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
outline: [2, 3]
title: Handle Effector's Events in UI-frameworks
date: 2024-01-26
---

# Handle Effector's _Events_ in UI-frameworks
Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/magazine/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
sidebar: false
rss: false
---

# Magazine
Expand Down
5 changes: 5 additions & 0 deletions apps/website/docs/magazine/migration_from_redux.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Migrating from Redux to Effector
date: 2024-03-08
---

# Migrating from Redux to Effector

This guide explains how to perform a gradual, non-blocking code migration from Redux to Effector.
Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/magazine/no_domains.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: You Don't Need Domains
date: 2024-01-26
---

# You Don't Need Domains
Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/magazine/no_methods.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Prefer Operators to Methods
date: 2024-01-26
---

# Prefer Operators to Methods
Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/magazine/watch_calls.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: .watch calls are (not) weird
date: 2024-01-26
---

# `.watch` calls are (not) weird
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"effector": "23.0.0",
"effector-vue": "23.0.0",
"eslint": "8.46.0",
"feed": "^4.2.2",
"glob": "^8.0.3",
"i18next": "23.0.0",
"nx": "16.5.x",
Expand All @@ -65,6 +66,7 @@
},
"dependencies": {
"@algolia/client-search": "^4.14.3",
"date-fns": "^3.6.0",
"sandpack-vue3": "^3.1.7"
}
}
26 changes: 26 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3d7ce19

Please sign in to comment.