angrybeanie-front-end/pages/tech-and-disability.js
James Purser 95d82dba8f Adding tech and disability rss link
Adding OG meta tags to articles and podcast episode
Refactoring featureimage to use smaller images
2022-07-01 16:43:50 +10:00

46 lines
No EOL
1.7 KiB
JavaScript
Executable file

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) {
if(context.query.page == null || context.query.page == '0') {
var page = 1;
} else {
var page = Number(context.query.page)
}
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
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.Slug, page, 5)
const secres = await fetch(serverRuntimeConfig.base_path + `/api/sections`)
const secdata = await secres.json()
const pagedata = {'title': 'Tech and Disability'}
return {
props: { articles, sections : secdata, pagedata, project, rssFeed}, // will be passed to the page component as props
}
}
function Project({ articles, sections, pagedata, project, rssFeed }) {
return <div><Head>
<link rel="alternate" type="application/rss+xml" title="Tech and Disability Feed" href={rssFeed} />
</Head>
<Layout sections={sections} pagedata={pagedata}>
<h1>{project.data[0].attributes.Title}</h1>
<div dangerouslySetInnerHTML={{ __html: project.data[0].attributes.Description }}></div>
<StoryPager storydata={articles} />
</Layout></div>
}
export default Project