Contains the following:
- Updates to reference the new Richtext field from Strapi - Update to include feature image in RSS - General cleanups (removing a lot of console.log) - I think there's a nextjs update in there as well
This commit is contained in:
parent
da2805db9e
commit
3b40fdfe98
13 changed files with 8672 additions and 3022 deletions
|
|
@ -3,7 +3,6 @@ import Image from "next/legacy/image";
|
|||
|
||||
const FeatureImage = ({ imagedata, basepath }) => {
|
||||
const imgSrc = basepath + imagedata.url
|
||||
console.log(imagedata)
|
||||
return (
|
||||
<div className="featuredimage">
|
||||
<Image
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import Link from 'next/link'
|
|||
|
||||
const GalleryPager = ({galleryImages, basepath, gallery}) => {
|
||||
|
||||
console.log(gallery)
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const handleImageClick = (e, path) => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
const PublishedInfo = (publishData) => {
|
||||
console.log(publishData)
|
||||
|
||||
var publishedDate = new Date(publishData.publishData.publishedAt)
|
||||
var updatedDate = new Date(publishData.publishData.updatedAt)
|
||||
|
|
|
|||
1
data/external/cms.js
vendored
1
data/external/cms.js
vendored
|
|
@ -33,6 +33,7 @@ export const getAllPosts = async (filter, page, limit) => {
|
|||
page: page,
|
||||
pageSize: limit
|
||||
},
|
||||
populate: '*',
|
||||
filters
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { Feed } from "feed"
|
||||
import getConfig from 'next/config'
|
||||
import { getAllPodcastSeries, getAllPosts, getProjectDetails } from "../external/cms"
|
||||
import fs from "fs"
|
||||
import config from './config'
|
||||
import htmlFindReplaceElementAttrs from "html-find-replace-element-attrs"
|
||||
import Image from "next/legacy/image"
|
||||
|
||||
export const generateRssFeed = async (filter) => {
|
||||
|
||||
|
|
@ -12,6 +14,8 @@ export const generateRssFeed = async (filter) => {
|
|||
|
||||
const siteURL = config.siteURL;
|
||||
|
||||
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
|
||||
|
||||
const date = new Date();
|
||||
|
||||
const Title = typeof filter === "undefined" ? "Angry Beanie" : project.data[0].attributes.Title
|
||||
|
|
@ -80,6 +84,17 @@ export const generateRssFeed = async (filter) => {
|
|||
}
|
||||
)
|
||||
|
||||
var fullbody;
|
||||
|
||||
if (post.attributes.FeatureImage.data) {
|
||||
const imagepath = serverRuntimeConfig.media_path + post.attributes.FeatureImage.data.attributes.formats.large.url
|
||||
const featuredImage = <Image src={imagepath} height="100%" width="100%" />
|
||||
console.log(featuredImage)
|
||||
fullbody = "<p><img src=" + imagepath + "></img></p>"+body
|
||||
} else {
|
||||
fullbody = body
|
||||
}
|
||||
|
||||
feed.addItem({
|
||||
|
||||
title: post.attributes.Title,
|
||||
|
|
@ -88,9 +103,9 @@ export const generateRssFeed = async (filter) => {
|
|||
|
||||
link: url,
|
||||
|
||||
description: body,
|
||||
description: fullbody,
|
||||
|
||||
content: body,
|
||||
content: fullbody,
|
||||
|
||||
author: [author],
|
||||
|
||||
|
|
|
|||
|
|
@ -39,15 +39,15 @@ export const generateSitemap = async () => {
|
|||
<lastmod>${getDate}</lastmod>
|
||||
<priority>1</priority>
|
||||
</url>`
|
||||
}).join("")
|
||||
}).join("")
|
||||
|
||||
const postListSiteMap = postList.map(post => {
|
||||
return `
|
||||
<url>
|
||||
<loc>${`${config.siteURL}/news/${post.slug}`}</loc>
|
||||
<lastmod>${post.updatedAt}</lastmod>
|
||||
<priority>0.5</priority>
|
||||
</url>`
|
||||
<url>
|
||||
<loc>${`${config.siteURL}/news/${post.slug}`}</loc>
|
||||
<lastmod>${post.updatedAt}</lastmod>
|
||||
<priority>0.5</priority>
|
||||
</url>`
|
||||
})
|
||||
.join("")
|
||||
|
||||
|
|
|
|||
7065
package-lock.json
generated
7065
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -11,8 +11,6 @@ import { init } from "@socialgouv/matomo-next";
|
|||
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL;
|
||||
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
|
||||
|
||||
console.log(MATOMO_URL);
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ export default galleryImage
|
|||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getAllGalleryImages()
|
||||
console.log(posts.data[1].attributes.galleries.data[0].attributes)
|
||||
const paths = posts.data.map((post) => ({
|
||||
params: { galleryImage: post.attributes.Slug, gallery: post.attributes.galleries.data[0].attributes.Slug },
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ export async function getStaticProps(context) {
|
|||
generateSitemap()
|
||||
const { serverRuntimeConfig } = getConfig()
|
||||
|
||||
console.log(serverRuntimeConfig)
|
||||
|
||||
const qs = require('qs')
|
||||
const query = qs.stringify({
|
||||
pagination: {
|
||||
|
|
@ -49,8 +47,6 @@ export async function getStaticProps(context) {
|
|||
|
||||
const combined = getLatestContent()
|
||||
|
||||
console.log(combined)
|
||||
|
||||
return {
|
||||
props: { article, pagedata, config: serverRuntimeConfig, firstimage, episodedata: epdata, siteConfig: config},
|
||||
revalidate: 60 // will be passed to the page component as props
|
||||
|
|
@ -69,8 +65,6 @@ function HomePage (props) {
|
|||
|
||||
var article_desc = props.article.Abstract.replace(new RegExp('<[^>]*>', 'g'), '')
|
||||
|
||||
console.log(props.serverRuntimeConfig)
|
||||
|
||||
return <Layout pagedata={props.pagedata}>
|
||||
<Head>
|
||||
<meta name="twitter:card" content={ article_desc } key="twcard" />
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const Article = ({article_obj, sections, pagedata, stories, serverRuntimeConfig,
|
|||
}
|
||||
<h1 className="page_title col-sm-12">{ article_obj.Title }</h1>
|
||||
<PublishedInfo publishData={article_obj}></PublishedInfo>
|
||||
<div className="article_body" dangerouslySetInnerHTML={{ __html: article_obj.Body }}></div>
|
||||
<div className="article_body" dangerouslySetInnerHTML={{ __html: article_obj.FullBody }}></div>
|
||||
</div>
|
||||
<StorySideBar stories={stories} />
|
||||
</Layout>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ export async function getStaticProps({params}) {
|
|||
const { serverRuntimeConfig } = getConfig()
|
||||
|
||||
return {
|
||||
props: { pagedata, serverRuntimeConfig, gallerylist }
|
||||
props: { pagedata, serverRuntimeConfig, gallerylist },
|
||||
revalidate: 60
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue