From db783414c9d02116f96468597b988fa8cf77cc64 Mon Sep 17 00:00:00 2001 From: James Purser Date: Sat, 18 Jun 2022 21:36:21 +1000 Subject: [PATCH] Fixed error in feed generation --- data/internal/feed-generator.js | 2 +- pages/tech-and-disability.js | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/data/internal/feed-generator.js b/data/internal/feed-generator.js index 88d4e62..2224737 100755 --- a/data/internal/feed-generator.js +++ b/data/internal/feed-generator.js @@ -7,7 +7,7 @@ export const generateRssFeed = async (filter) => { const project = await getProjectDetails(filter); - const posts = await getAllPosts(project.data[0].attributes.tags); + const posts = typeof filter === "undefined" ? await getAllPosts() : await getAllPosts(project.data[0].attributes.tags); const siteURL = config.siteURL; diff --git a/pages/tech-and-disability.js b/pages/tech-and-disability.js index 2c17efe..eed6b4a 100755 --- a/pages/tech-and-disability.js +++ b/pages/tech-and-disability.js @@ -1,8 +1,10 @@ import "../components/main" import getConfig from 'next/config' +import config from "../data/internal/config" import Layout from "../components/main" import StoryPager from "../components/storypager" import { getAllPosts, getProjectDetails } from "../data/external/cms"; +import Head from 'next/head' //import { popStoryPager } from "../data/external/cms" export async function getServerSideProps(context) { @@ -16,6 +18,8 @@ export async function getServerSideProps(context) { const project = await getProjectDetails('tech-and-disability') + const rssFeed = config.siteURL+"/feed/"+project.data[0].attributes.Slug+"-feed.xml" + const articles = await getAllPosts(project.data[0].attributes.tags, page, 5) const secres = await fetch(serverRuntimeConfig.base_path + `/api/sections`) @@ -24,16 +28,19 @@ export async function getServerSideProps(context) { const pagedata = {'title': 'Tech and Disability'} return { - props: { articles, sections : secdata, pagedata, project }, // will be passed to the page component as props + props: { articles, sections : secdata, pagedata, project, rssFeed}, // will be passed to the page component as props } } -function Project({ articles, sections, pagedata, project }) { - return +function Project({ articles, sections, pagedata, project, rssFeed }) { + return
+ + +

{project.data[0].attributes.Title}

-
+
} export default Project \ No newline at end of file