Skip to content

Commit

Permalink
truncate news content before 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed Apr 24, 2024
1 parent 6a78a01 commit 6212c1b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/v4/layout/NewsColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const NewsColumn = ({
>
{/* <Container maxWidth="max-w-[1320px] w-full"> */}
{showHeader !== false && (
<div className="flex justify-between p-2.5 pb-4 rounded-t-2xl">
<div className="flex justify-between p-3 pb-4 rounded-t-2xl">
<div className="flex">
<div>
<div className="flex">
Expand Down Expand Up @@ -170,7 +170,7 @@ const NewsColumn = ({
</div>
)}
<div className="max-h-[46rem] relative">
<div className="pl-2 pt-2 pr-2 h-full max-h-[46rem] overflow-y-auto">
<div className="p-3 h-full max-h-[46rem] overflow-y-auto">
{["today", "yesterday", "thisWeek", "lastWeek", "lastMonth"].map(
group => {
let formattedGroup = group.replace("last", "last ");
Expand Down
2 changes: 1 addition & 1 deletion components/v4/section/NewsletterSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const NewsletterSection = ({title,padding}) =>{
<Container padding={padding} maxWidth="max-w-[1320px]">
<div className="mt-8 lg:px-0 lg:mt-0">
<div
className="w-full shadow-sm border border-gray-300/50 relative flex h-full bg-[#eef2ff] w-full lg:mt-8 rounded-3xl p-6"
className="w-full relative flex h-full bg-[#eef2ff] w-full lg:mt-8 rounded-3xl p-6"
>
<div className="max-w-xl lg:max-w-xl z-20">
<h3 className="text-xl tracking-tight lg:text-3xl mb-4 font-inter text-black/90 font-semibold">{title?title:<>
Expand Down
10 changes: 9 additions & 1 deletion pages/news/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,14 @@ export async function getStaticProps({

const postData = data?.posts.data[0];

//filter the content for posts before 2022
if (new Date(postData.attributes.date) < new Date("2024-01-01")) {
// postData.attributes.content = postData.attributes.content.replace(
//truncate the content to 400 characters
postData.attributes.content =
postData.attributes?.content?.substring(0, 400) + "...";
}

let link = data?.posts.data[0].attributes.link;
if (!link) {
link = data?.posts.data[0].attributes.legacyAttributes?.link
Expand Down Expand Up @@ -498,7 +506,7 @@ export async function getStaticProps({
props: {
preview,
post: {
...data?.posts.data[0],
...postData,
},
domain,
link,
Expand Down

0 comments on commit 6212c1b

Please sign in to comment.