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 FeatureImage = ({ imagedata, basepath }) => {
|
||||||
const imgSrc = basepath + imagedata.url
|
const imgSrc = basepath + imagedata.url
|
||||||
console.log(imagedata)
|
|
||||||
return (
|
return (
|
||||||
<div className="featuredimage">
|
<div className="featuredimage">
|
||||||
<Image
|
<Image
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ import Link from 'next/link'
|
||||||
|
|
||||||
const GalleryPager = ({galleryImages, basepath, gallery}) => {
|
const GalleryPager = ({galleryImages, basepath, gallery}) => {
|
||||||
|
|
||||||
console.log(gallery)
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const handleImageClick = (e, path) => {
|
const handleImageClick = (e, path) => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
const PublishedInfo = (publishData) => {
|
const PublishedInfo = (publishData) => {
|
||||||
console.log(publishData)
|
|
||||||
|
|
||||||
var publishedDate = new Date(publishData.publishData.publishedAt)
|
var publishedDate = new Date(publishData.publishData.publishedAt)
|
||||||
var updatedDate = new Date(publishData.publishData.updatedAt)
|
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,
|
page: page,
|
||||||
pageSize: limit
|
pageSize: limit
|
||||||
},
|
},
|
||||||
|
populate: '*',
|
||||||
filters
|
filters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
import { Feed } from "feed"
|
import { Feed } from "feed"
|
||||||
|
import getConfig from 'next/config'
|
||||||
import { getAllPodcastSeries, getAllPosts, getProjectDetails } from "../external/cms"
|
import { getAllPodcastSeries, getAllPosts, getProjectDetails } from "../external/cms"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import config from './config'
|
import config from './config'
|
||||||
import htmlFindReplaceElementAttrs from "html-find-replace-element-attrs"
|
import htmlFindReplaceElementAttrs from "html-find-replace-element-attrs"
|
||||||
|
import Image from "next/legacy/image"
|
||||||
|
|
||||||
export const generateRssFeed = async (filter) => {
|
export const generateRssFeed = async (filter) => {
|
||||||
|
|
||||||
|
|
@ -12,6 +14,8 @@ export const generateRssFeed = async (filter) => {
|
||||||
|
|
||||||
const siteURL = config.siteURL;
|
const siteURL = config.siteURL;
|
||||||
|
|
||||||
|
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
|
||||||
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
||||||
const Title = typeof filter === "undefined" ? "Angry Beanie" : project.data[0].attributes.Title
|
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({
|
feed.addItem({
|
||||||
|
|
||||||
title: post.attributes.Title,
|
title: post.attributes.Title,
|
||||||
|
|
@ -88,9 +103,9 @@ export const generateRssFeed = async (filter) => {
|
||||||
|
|
||||||
link: url,
|
link: url,
|
||||||
|
|
||||||
description: body,
|
description: fullbody,
|
||||||
|
|
||||||
content: body,
|
content: fullbody,
|
||||||
|
|
||||||
author: [author],
|
author: [author],
|
||||||
|
|
||||||
|
|
|
||||||
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_URL = process.env.NEXT_PUBLIC_MATOMO_URL;
|
||||||
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
|
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
|
||||||
|
|
||||||
console.log(MATOMO_URL);
|
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }) {
|
function MyApp({ Component, pageProps }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ export default galleryImage
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await getAllGalleryImages()
|
const posts = await getAllGalleryImages()
|
||||||
console.log(posts.data[1].attributes.galleries.data[0].attributes)
|
|
||||||
const paths = posts.data.map((post) => ({
|
const paths = posts.data.map((post) => ({
|
||||||
params: { galleryImage: post.attributes.Slug, gallery: post.attributes.galleries.data[0].attributes.Slug },
|
params: { galleryImage: post.attributes.Slug, gallery: post.attributes.galleries.data[0].attributes.Slug },
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ export async function getStaticProps(context) {
|
||||||
generateSitemap()
|
generateSitemap()
|
||||||
const { serverRuntimeConfig } = getConfig()
|
const { serverRuntimeConfig } = getConfig()
|
||||||
|
|
||||||
console.log(serverRuntimeConfig)
|
|
||||||
|
|
||||||
const qs = require('qs')
|
const qs = require('qs')
|
||||||
const query = qs.stringify({
|
const query = qs.stringify({
|
||||||
pagination: {
|
pagination: {
|
||||||
|
|
@ -49,8 +47,6 @@ export async function getStaticProps(context) {
|
||||||
|
|
||||||
const combined = getLatestContent()
|
const combined = getLatestContent()
|
||||||
|
|
||||||
console.log(combined)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { article, pagedata, config: serverRuntimeConfig, firstimage, episodedata: epdata, siteConfig: config},
|
props: { article, pagedata, config: serverRuntimeConfig, firstimage, episodedata: epdata, siteConfig: config},
|
||||||
revalidate: 60 // will be passed to the page component as props
|
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'), '')
|
var article_desc = props.article.Abstract.replace(new RegExp('<[^>]*>', 'g'), '')
|
||||||
|
|
||||||
console.log(props.serverRuntimeConfig)
|
|
||||||
|
|
||||||
return <Layout pagedata={props.pagedata}>
|
return <Layout pagedata={props.pagedata}>
|
||||||
<Head>
|
<Head>
|
||||||
<meta name="twitter:card" content={ article_desc } key="twcard" />
|
<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>
|
<h1 className="page_title col-sm-12">{ article_obj.Title }</h1>
|
||||||
<PublishedInfo publishData={article_obj}></PublishedInfo>
|
<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>
|
</div>
|
||||||
<StorySideBar stories={stories} />
|
<StorySideBar stories={stories} />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ export async function getStaticProps({params}) {
|
||||||
const { serverRuntimeConfig } = getConfig()
|
const { serverRuntimeConfig } = getConfig()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { pagedata, serverRuntimeConfig, gallerylist }
|
props: { pagedata, serverRuntimeConfig, gallerylist },
|
||||||
|
revalidate: 60
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue