Skip to content

Commit 1609338

Browse files
Add rss feed to the website.
1 parent c2c5314 commit 1609338

File tree

11 files changed

+4545
-1762
lines changed

11 files changed

+4545
-1762
lines changed

docusaurus.config.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const config: Config = {
2020
organizationName: "/HaudinFlorence/", // Usually your GitHub org/user name.
2121
projectName: "quantstack.github.io", // Usually your repo name.
2222

23-
onBrokenLinks: "throw",
23+
onBrokenLinks: "warn",
2424
onBrokenMarkdownLinks: "warn",
2525
staticDirectories: ["static"],
2626

@@ -52,6 +52,7 @@ const config: Config = {
5252
},
5353
theme: {
5454
customCss: "./src/css/custom.css",
55+
5556
},
5657
} satisfies Preset.Options,
5758
],
@@ -61,6 +62,17 @@ const config: Config = {
6162
// Replace with your project's social card
6263
//image: 'img/docusaurus-social-card.jpg',
6364
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
65+
headTags: [
66+
{
67+
tagName: 'link',
68+
attributes: {
69+
rel: 'alternate',
70+
type: 'application/rss+xml',
71+
title: 'RSS Feed',
72+
href: '/rss.xml',
73+
},
74+
},
75+
],
6476
navbar: {
6577
title: "",
6678
logo: {
@@ -99,13 +111,22 @@ const config: Config = {
99111
label: "Blog",
100112
position: "left",
101113
},
114+
{
115+
label: 'RSS',
116+
href: 'rss.xml',
117+
position: 'left',
118+
target: '_blank',
119+
rel: 'noopener noreferrer',
120+
},
102121
{
103122
to: "/contact/",
104123
label: "CONTACT US",
105124
position: "right",
106125
className: "contact",
107126
},
108127

128+
129+
109130
{
110131
to: "https://github.com/QuantStack",
111132
title: "GitHub",

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"react-slick": "^0.30.2",
4949
"reactjs-popup": "^2.0.6",
5050
"request": "^2.88.2",
51+
"rss": "^1.2.2",
5152
"slick-carousel": "^1.8.1"
5253
},
5354
"devDependencies": {

scripts/generate-rss-feed.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const fs = require('fs');
2+
const RSS = require('rss');
3+
const { blogpostsDetails } = require('../src/components/blog/blogpostsDetails.js');
4+
5+
const feed = new RSS({
6+
title: 'My Custom Blog',
7+
description: 'RSS feed for my custom blog pages',
8+
feed_url: 'https://quantstack.net/rss.xml',
9+
site_url: 'https://quantstack.net',
10+
language: 'en',
11+
});
12+
const posts = [];
13+
blogpostsDetails.forEach(post => {
14+
const imagePath = 'https://quantstack.net' + post.image;
15+
console.log('imagePath:', imagePath)
16+
posts.push({
17+
title: post.title,
18+
description: post.summary,
19+
date: post.date,
20+
authors: post.authors,
21+
url: post.url,
22+
image: post.image,
23+
enclosure: {
24+
url: 'https://quantstack.net' + post.image,
25+
type: 'image/png', // or 'image/png', etc.
26+
length: 0, // optional, but required by some validators
27+
},
28+
})
29+
})
30+
31+
posts.forEach((post) => {
32+
feed.item({
33+
title: post.title,
34+
description: post.description,
35+
url: post.url,
36+
date: post.date,
37+
});
38+
});
39+
40+
fs.writeFileSync('../static/rss.xml', feed.xml({ indent: true }));

0 commit comments

Comments
 (0)