Skip to content

Add rss feed to the website. #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const config: Config = {
organizationName: "/HaudinFlorence/", // Usually your GitHub org/user name.
projectName: "quantstack.github.io", // Usually your repo name.

onBrokenLinks: "throw",
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
staticDirectories: ["static"],

Expand Down Expand Up @@ -52,6 +52,7 @@ const config: Config = {
},
theme: {
customCss: "./src/css/custom.css",

},
} satisfies Preset.Options,
],
Expand All @@ -61,6 +62,17 @@ const config: Config = {
// Replace with your project's social card
//image: 'img/docusaurus-social-card.jpg',
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
headTags: [
{
tagName: 'link',
attributes: {
rel: 'alternate',
type: 'application/rss+xml',
title: 'RSS Feed',
href: '/rss.xml',
},
},
],
navbar: {
title: "",
logo: {
Expand Down Expand Up @@ -99,13 +111,22 @@ const config: Config = {
label: "Blog",
position: "left",
},
{
label: 'RSS',
href: 'rss.xml',
position: 'left',
target: '_blank',
rel: 'noopener noreferrer',
},
{
to: "/contact/",
label: "CONTACT US",
position: "right",
className: "contact",
},



{
to: "https://github.com/QuantStack",
title: "GitHub",
Expand Down
38 changes: 38 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"react-slick": "^0.30.2",
"reactjs-popup": "^2.0.6",
"request": "^2.88.2",
"rss": "^1.2.2",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
Expand Down
40 changes: 40 additions & 0 deletions scripts/generate-rss-feed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const fs = require('fs');
const RSS = require('rss');
const { blogpostsDetails } = require('../src/components/blog/blogpostsDetails.js');

const feed = new RSS({
title: 'My Custom Blog',
description: 'RSS feed for my custom blog pages',
feed_url: 'https://quantstack.net/rss.xml',
site_url: 'https://quantstack.net',
language: 'en',
});
const posts = [];
blogpostsDetails.forEach(post => {
const imagePath = 'https://quantstack.net' + post.image;
console.log('imagePath:', imagePath)
posts.push({
title: post.title,
description: post.summary,
date: post.date,
authors: post.authors,
url: post.url,
image: post.image,
enclosure: {
url: 'https://quantstack.net' + post.image,
type: 'image/png', // or 'image/png', etc.
length: 0, // optional, but required by some validators
},
})
})

posts.forEach((post) => {
feed.item({
title: post.title,
description: post.description,
url: post.url,
date: post.date,
});
});

fs.writeFileSync('../static/rss.xml', feed.xml({ indent: true }));
Loading